Submission #1216802

#TimeUsernameProblemLanguageResultExecution timeMemory
1216802mariamp1동굴 (IOI13_cave)C++20
Compilation error
0 ms0 KiB
int tryCombination(int S[]);
void answer(int S[], int D[]);

void exploreCave(int N) {
    int S[N];
    int D[N];
    bool used[N] = {false};

    for (int door = 0; door < N; ++door) {
        int fixedS[N];
        for (int i = 0; i < N; ++i)
            fixedS[i] = used[i] ? S[i] : 0;

        int result = tryCombination(fixedS);
        int targetValue = (result == -1 || result > door) ? 0 : 1;

        int lo = 0, hi = N - 1, sw = -1;
        while (lo <= hi) {
            int mid = (lo + hi) / 2;
            for (int i = 0; i < N; ++i)
                fixedS[i] = used[i] ? S[i] : targetValue;
            for (int i = lo; i <= mid; ++i)
                if (!used[i]) fixedS[i] = 1 - targetValue;

            int res = tryCombination(fixedS);
            if (res == -1 || res > door)
                hi = mid;
            else
                lo = mid + 1;

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

        D[door] = sw;
        S[sw] = targetValue;
        used[sw] = true;
    }

    answer(S, D);
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccACsbkI.o: in function `main':
grader.c:(.text.startup+0x10): undefined reference to `exploreCave'
/usr/bin/ld: /tmp/ccDVymaV.o: in function `exploreCave(int)':
cave.cpp:(.text+0x1de): undefined reference to `tryCombination(int*)'
/usr/bin/ld: cave.cpp:(.text+0x287): undefined reference to `tryCombination(int*)'
/usr/bin/ld: cave.cpp:(.text+0x303): undefined reference to `answer(int*, int*)'
/usr/bin/ld: cave.cpp:(.text+0x360): undefined reference to `tryCombination(int*)'
collect2: error: ld returned 1 exit status