Submission #629334

#TimeUsernameProblemLanguageResultExecution timeMemory
629334StavabCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
void exploreCave(int n) { int s[n], d[n]; for(int i = 0; i < n; i++) { s[i] = 0; d[i] = -1; } int cur, prev, door; for(int i = 0; i < n; i++) { door = tryCombination(s); if(door > i || door == -1) prev = 1; else prev = 0; int low = 0, high = n; while(high - low > 2) { int middle = (low + high) / 2; for(int j = low; j <= middle; j++) { if(d[j] != -1) continue; if(s[j]) s[j] = 0; else s[j] = 1; } door = tryCombination(s); if(door > i || door == -1) cur = 1; else cur = 0; if(cur == prev) low = middle; else high = middle; prev = cur; } if(s[low]) s[low] = 0; else s[low] = 1; door = tryCombination(s); if(door > i || door == -1) cur = 1; else cur = 0; int ind; if(cur == prev) { d[high] = i; ind = high; } else { d[low] = i; ind = low; } door = tryCombination(s); if(door <= i) { if(s[ind]) s[ind] = 0; else s[ind] = 1; } } answer(s, d); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:13:16: error: 'tryCombination' was not declared in this scope
   13 |         door = tryCombination(s);
      |                ^~~~~~~~~~~~~~
cave.cpp:74:5: error: 'answer' was not declared in this scope
   74 |     answer(s, d);
      |     ^~~~~~