Submission #1088471

#TimeUsernameProblemLanguageResultExecution timeMemory
1088471anastasiskolioCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define MAXN 5000 using namespace std; int S[MAXN], D[MAXN], alreadyInCorrectState[MAXN]; void adjustSwitches(int lo, int mid, int hi, int x, int y) { for (int i = lo; i <= mid; i++) if (!alreadyInCorrectState[i]) S[i] = x; for (int i = mid + 1; i <= hi; i++) if (!alreadyInCorrectState[i]) S[i] = y; } int findTheCorrectDoor(int currentSwitch, int lo, int hi) { if (lo == hi) return lo; int mid = (lo + hi) / 2; adjustSwitches(lo, mid, hi, S[currentSwitch], !S[currentSwitch]); int ans = tryCombination(S); if (ans == -1 || ans > mid) return findTheCorrectDoor(currentSwitch, lo, mid); else return findTheCorrectDoor(currentSwitch, mid + 1, hi); } void findTheCorrectState(int currentSwitch, int N) { adjustSwitches(0, (N - 1) / 2, N - 1, 1, 1); int ans = tryCombination(S); S[currentSwitch] = ans == -1 || ans > currentSwitch; alreadyInCorrectState[currentSwitch] = 1; } void exploreCave(int N) { for (int i = 0; i < N; i++) { findTheCorrectState(i, N); D[i] = findTheCorrectDoor(i, 0, N - 1); } answer(S, D); }

Compilation message (stderr)

cave.cpp: In function 'int findTheCorrectDoor(int, int, int)':
cave.cpp:21:13: error: 'tryCombination' was not declared in this scope
   21 |   int ans = tryCombination(S);
      |             ^~~~~~~~~~~~~~
cave.cpp: In function 'void findTheCorrectState(int, int)':
cave.cpp:30:13: error: 'tryCombination' was not declared in this scope
   30 |   int ans = tryCombination(S);
      |             ^~~~~~~~~~~~~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:41:3: error: 'answer' was not declared in this scope
   41 |   answer(S, D);
      |   ^~~~~~