Submission #593439

#TimeUsernameProblemLanguageResultExecution timeMemory
593439gortomiCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include "graderlib.c"

int main() {
    int N;
	N = init();
	exploreCave(N);
    printf("INCORRECT\nYour solution did not call answer().\n");
	return 0;
}
void exploreCave(int n)
{
    int position[n];
    for(int i = 0; i < n; i++) position[i] = -1;
    int guess[n];
    int ans[n];
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < n; j++) guess[j] = position[j] == -1 ? 1 : position[j];
        int x = tryCombination(guess);
        if(x == -1) x = n;
        position[i] = x > i;
        int l = 0, r = n - 1;
        while(l != r)
        {
            int mid = (l + r) / 2;
            for(int j = 0; j < l; j++) guess[j] = position[j] == -1 ? 1 - position[i] : position[j];
            for(int j = l; j <= mid; j++) guess[j] = position[j] == -1 ? position[i] : position[j];
            for(int j = mid + 1; j < n; j++) guess[j] = position[j] == -1 ? 1 - position[i] : position[j];
            int x = tryCombination(guess);
            if(x == -1) x = n;
            if(x > i) r = mid;
            else l = mid + 1;
        }
        ans[l] = i;
    }
    answer(position, ans);
}

Compilation message (stderr)

/usr/bin/ld: /tmp/cck4cjRa.o: in function `answer':
cave.cpp:(.text+0x0): multiple definition of `answer'; /tmp/cch4gB2c.o:grader.c:(.text+0x0): first defined here
/usr/bin/ld: /tmp/cck4cjRa.o: in function `tryCombination':
cave.cpp:(.text+0x80): multiple definition of `tryCombination'; /tmp/cch4gB2c.o:grader.c:(.text+0x80): first defined here
/usr/bin/ld: /tmp/cck4cjRa.o: in function `init()':
cave.cpp:(.text+0x110): multiple definition of `init()'; /tmp/cch4gB2c.o:grader.c:(.text+0x110): first defined here
/usr/bin/ld: /tmp/cck4cjRa.o: in function `main':
cave.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cch4gB2c.o:grader.c:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status