Submission #1216800

#TimeUsernameProblemLanguageResultExecution timeMemory
1216800mariamp1Cave (IOI13_cave)C++20
Compilation error
0 ms0 KiB
void exploreCave(int N) {
    int S[N];
    int D[N];
    int used[N];

    for (int i = 0; i < N; ++i) {
        used[i] = 0;
        S[i] = 0;
    }

    int ts[N];

    for (int door = 0; door < N; ++door) {
        for (int i = 0; i < N; ++i) ts[i] = 0;
        int result = tryCombination(ts);
        int rs;
        if (result > door || result == -1) {
            rs = 0;
        } else {
            rs = 1;
        }
        int lo = 0, hi = N - 1;
        int swind = -1;
        while (lo <= hi) {
            int mid = (lo + hi) / 2;
            for (int i = 0; i < N; ++i) {
                if (used[i]) ts[i] = S[i];
                else ts[i] = rs;
            }
            for (int i = lo; i <= mid; ++i) {
                if (!used[i]) ts[i] = 1 - rs;
            }
            int res = tryCombination(ts);
            if (res > door || res == -1) {
                hi = mid;
            } else {
                lo = mid + 1;
            }

            if (lo == hi) {
                swind = lo;
                break;
            }
        }

        D[door] = swind;
        S[swind] = rs;
        used[swind] = 1;
    }

    answer(S, D);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:15:22: error: 'tryCombination' was not declared in this scope
   15 |         int result = tryCombination(ts);
      |                      ^~~~~~~~~~~~~~
cave.cpp:51:5: error: 'answer' was not declared in this scope
   51 |     answer(S, D);
      |     ^~~~~~