Submission #813301

#TimeUsernameProblemLanguageResultExecution timeMemory
813301PikachuCave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;

template<typename T>
inline bool maxi(T &x, const T &val)
{
    if (x < val) return x = val, true;
    return false;
}

template<typename T>
inline bool mini(T &x, const T &val)
{
    if (x > val) return x = val, true;
    return false;
}

int tryCombination(int S[]);
void answer(int S[], int D[]);

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)

/usr/bin/ld: /tmp/cc03zGca.o: in function `main':
grader.c:(.text.startup+0x10): undefined reference to `exploreCave'
/usr/bin/ld: /tmp/ccpLgAM9.o: in function `exploreCave(int)':
cave.cpp:(.text+0xa0): undefined reference to `tryCombination(int*)'
/usr/bin/ld: cave.cpp:(.text+0x129): undefined reference to `tryCombination(int*)'
/usr/bin/ld: cave.cpp:(.text+0x1d0): undefined reference to `tryCombination(int*)'
/usr/bin/ld: cave.cpp:(.text+0x188): undefined reference to `answer(int*, int*)'
collect2: error: ld returned 1 exit status