Submission #321325

#TimeUsernameProblemLanguageResultExecution timeMemory
321325ronnithRegions (IOI09_regions)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define FOR(i,a,b) for(int i = a;i < b;i ++) #define trav(e,x) for(auto e:x) #define maxn 200000 #define maxr 25000 using namespace std; ll N, R, Q, region[maxn], ans[maxr][maxr]; vector<ll> adj[maxn]; void dfs(ll x,ll pr,ll crr,ll val) { if(region[x] == crr)val ++; ans[crr][region[x]] += val; trav(e,adj[x]) { if(e != pr) { dfs(e,x,crr,val); } } } void preProccess() { FOR(i,0,R) { dfs(0,-1,i,0); } } int main() { scanf("%d%d%d",&N,&R,&Q); int x,y; scanf("%d",&x); region[0] = x - 1; FOR(i,0,N - 1) { scanf("%d%d",&x,&y); x --;y --; adj[i + 1].push_back(x); adj[x].push_back(i + 1); region[i + 1] = y; } FOR(i,0,R) { fill(ans[i],ans[i] + R,0); } preProccess(); FOR(i,0,Q) { scanf("%d%d",&x,&y); x --;y --; printf("%d\n", ans[x][y]); fflush(stdout); } return 0; }

Compilation message (stderr)

regions.cpp:10:1: error: 'll' does not name a type
   10 | ll N, R, Q, region[maxn], ans[maxr][maxr];
      | ^~
regions.cpp:11:8: error: 'll' was not declared in this scope
   11 | vector<ll> adj[maxn];
      |        ^~
regions.cpp:11:10: error: template argument 1 is invalid
   11 | vector<ll> adj[maxn];
      |          ^
regions.cpp:11:10: error: template argument 2 is invalid
regions.cpp:13:10: error: variable or field 'dfs' declared void
   13 | void dfs(ll x,ll pr,ll crr,ll val)
      |          ^~
regions.cpp:13:10: error: 'll' was not declared in this scope
regions.cpp:13:15: error: 'll' was not declared in this scope
   13 | void dfs(ll x,ll pr,ll crr,ll val)
      |               ^~
regions.cpp:13:21: error: 'll' was not declared in this scope
   13 | void dfs(ll x,ll pr,ll crr,ll val)
      |                     ^~
regions.cpp:13:28: error: 'll' was not declared in this scope
   13 | void dfs(ll x,ll pr,ll crr,ll val)
      |                            ^~
regions.cpp: In function 'void preProccess()':
regions.cpp:28:10: error: 'R' was not declared in this scope
   28 |  FOR(i,0,R)
      |          ^
regions.cpp:3:38: note: in definition of macro 'FOR'
    3 | #define FOR(i,a,b) for(int i = a;i < b;i ++)
      |                                      ^
regions.cpp:30:3: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   30 |   dfs(0,-1,i,0);
      |   ^~~
      |   ffs
regions.cpp: In function 'int main()':
regions.cpp:36:18: error: 'N' was not declared in this scope
   36 |  scanf("%d%d%d",&N,&R,&Q);
      |                  ^
regions.cpp:36:21: error: 'R' was not declared in this scope
   36 |  scanf("%d%d%d",&N,&R,&Q);
      |                     ^
regions.cpp:36:24: error: 'Q' was not declared in this scope
   36 |  scanf("%d%d%d",&N,&R,&Q);
      |                        ^
regions.cpp:40:2: error: 'region' was not declared in this scope
   40 |  region[0] = x - 1;
      |  ^~~~~~
regions.cpp:45:14: error: request for member 'push_back' in 'adj[(i + 1)]', which is of non-class type 'int'
   45 |   adj[i + 1].push_back(x);
      |              ^~~~~~~~~
regions.cpp:46:10: error: request for member 'push_back' in 'adj[x]', which is of non-class type 'int'
   46 |   adj[x].push_back(i + 1);
      |          ^~~~~~~~~
regions.cpp:51:8: error: 'ans' was not declared in this scope; did you mean 'abs'?
   51 |   fill(ans[i],ans[i] + R,0);
      |        ^~~
      |        abs
regions.cpp:60:18: error: 'ans' was not declared in this scope; did you mean 'abs'?
   60 |   printf("%d\n", ans[x][y]);
      |                  ^~~
      |                  abs
regions.cpp:39:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   39 |  scanf("%d",&x);
      |  ~~~~~^~~~~~~~~
regions.cpp:43:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   43 |   scanf("%d%d",&x,&y);
      |   ~~~~~^~~~~~~~~~~~~~
regions.cpp:58:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   58 |   scanf("%d%d",&x,&y);
      |   ~~~~~^~~~~~~~~~~~~~