Submission #538177

#TimeUsernameProblemLanguageResultExecution timeMemory
538177hmm789Speedrun (RMI21_speedrun)C++14
Compilation error
0 ms0 KiB
vector<int> adj[1000]; int pre[1000], cur, vtx[1000]; void dfs(int x, int p) { vtx[cur] = x; pre[x] = cur++; int tmp = p, pwr = 1; if(tmp == -1) tmp = 1023; while(tmp > 0) { setHint(x+1, pwr, tmp%2); tmp /= 2; pwr++; } for(auto i : adj[x]) if(i != p) dfs(i, x); } void assignHints(int subtask , int N, int A[], int B[]) { setHintLen(20); for(int i = 1; i < N; i++) { adj[A[i]-1].push_back(B[i]-1); adj[B[i]-1].push_back(A[i]-1); } dfs(0, -1); for(int i = 0; i < N; i++) { int tmp, pwr = 11; if(pre[i] == N-1) tmp = vtx[0]; else tmp = vtx[pre[i]+1]; while(tmp > 0) { setHint(i+1, pwr, tmp%2); tmp /= 2; pwr++; } } } void speedrun(int subtask , int N, int start) { start--; int cur = start, nxt; do { nxt = 0; for(int i = 11; i <= 20; i++) nxt += getHint(i) * (1<<(i-11)); while(!goTo(nxt+1)) { int p = 0; for(int i = 1; i <= 10; i++) p += getHint(i) * (1<<(i-1)); goTo(p+1); } cur = nxt; } while(cur != start); }

Compilation message (stderr)

speedrun.cpp:1:1: error: 'vector' does not name a type
    1 | vector<int> adj[1000];
      | ^~~~~~
speedrun.cpp: In function 'void dfs(int, int)':
speedrun.cpp:10:3: error: 'setHint' was not declared in this scope
   10 |   setHint(x+1, pwr, tmp%2);
      |   ^~~~~~~
speedrun.cpp:14:15: error: 'adj' was not declared in this scope
   14 |  for(auto i : adj[x]) if(i != p) dfs(i, x);
      |               ^~~
speedrun.cpp: In function 'void assignHints(int, int, int*, int*)':
speedrun.cpp:18:2: error: 'setHintLen' was not declared in this scope
   18 |  setHintLen(20);
      |  ^~~~~~~~~~
speedrun.cpp:20:3: error: 'adj' was not declared in this scope
   20 |   adj[A[i]-1].push_back(B[i]-1);
      |   ^~~
speedrun.cpp:29:4: error: 'setHint' was not declared in this scope
   29 |    setHint(i+1, pwr, tmp%2);
      |    ^~~~~~~
speedrun.cpp: In function 'void speedrun(int, int, int)':
speedrun.cpp:42:40: error: 'getHint' was not declared in this scope
   42 |   for(int i = 11; i <= 20; i++) nxt += getHint(i) * (1<<(i-11));
      |                                        ^~~~~~~
speedrun.cpp:43:10: error: 'goTo' was not declared in this scope
   43 |   while(!goTo(nxt+1)) {
      |          ^~~~
speedrun.cpp:45:38: error: 'getHint' was not declared in this scope
   45 |    for(int i = 1; i <= 10; i++) p += getHint(i) * (1<<(i-1));
      |                                      ^~~~~~~