Submission #922938

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9229382024-02-06 10:17:06vjudge1Digital Circuit (IOI22_circuit)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
const int N = 2e5 + 5;
const int mod = 1000002022;
void add(int &a, int b){
a += b;
if (a >= mod) a -= mod;
if (a < 0) a += mod;
}
vector <int> adj[N], pre[N], suf[N];
int sz[N], val[N];
void dfs(int u){
sz[u] = 1;
for (int i = 0; i < adj[u].size(); ++ i){
int v = adj[u][i];
dfs(v);
if (!i) pre[u].pb(sz[v]);
else pre[u].pb(1ll * pre[u].back() * sz[v] % mod);
suf[u].pb(0);
sz[u] += sz[v];
}
for (int i = adj[u].size() - 1; i >= 0; -- i){
int v = adj[u][i];
if (i == int(adj[u].size() - 1)) suf[u][i] = sz[v];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

circuit.cpp: In function 'void dfs(int)':
circuit.cpp:20:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for (int i = 0; i < adj[u].size(); ++ i){
      |                     ~~^~~~~~~~~~~~~~~
circuit.cpp: In function 'void get(int)':
circuit.cpp:36:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     for (int i = 0; i < adj[u].size(); ++ i){
      |                     ~~^~~~~~~~~~~~~~~
circuit.cpp:40:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         if (i < adj[u].size() - 1) val[v] = 1ll * val[v] * suf[u][i + 1] % mod;
      |             ~~^~~~~~~~~~~~~~~~~~~
circuit.cpp: In function 'void build(int, int, int, int)':
circuit.cpp:63:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   63 |     int mid = l + r >> 1;
      |               ~~^~~
circuit.cpp: In function 'void upd(int, int, int, int, int)':
circuit.cpp:98:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   98 |     int mid = l + r >> 1;
      |               ~~^~~
/usr/bin/ld: /tmp/ccv2no0B.o: in function `main':
stub.cpp:(.text.startup+0x128): undefined reference to `init(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status