Submission #813303

#TimeUsernameProblemLanguageResultExecution timeMemory
813303PikachuCave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
using namespace std;

const int maxn = 5010;
int n;
int S[maxn], D[maxn];
bool done[maxn];

void reverse(int l = 0, int r = n - 1)
{
    for (int i = l; i <= r; i++) {
        if (!done[i]) S[i] = !S[i];
    }
}

void exploreCave(int n)
{
    ::n = n;
    for (int i = 0; i < n; i++) {
        if (tryCombination(S) == i) reverse();
        int l = 0;
        int r = n - 1;
        while (l < r) {
            int mid = (l + r) >> 1;
            reverse(l, mid);
            if (tryCombination(S) == i) {
                r = mid;
            }
            else l = mid + 1;
            reverse(l, mid);
        }
        done[l] = true;
        D[l] = i;
    }
    answer(S, D);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:19:13: error: 'tryCombination' was not declared in this scope
   19 |         if (tryCombination(S) == i) reverse();
      |             ^~~~~~~~~~~~~~
cave.cpp:25:17: error: 'tryCombination' was not declared in this scope
   25 |             if (tryCombination(S) == i) {
      |                 ^~~~~~~~~~~~~~
cave.cpp:34:5: error: 'answer' was not declared in this scope
   34 |     answer(S, D);
      |     ^~~~~~