Submission #839277

#TimeUsernameProblemLanguageResultExecution timeMemory
839277AlfraganusCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include "cave.h"
#include "grader.c"
#include <vector>
using namespace std;

bool used[5001];
int bits[5001], a[5001];

bool check(int l, int r){
    for(int i = l; i <= r; i ++)
        if(!used[i])
            return false;
    return true;
}

void color(int l, int r, int x){
    for(int i = l; i <= r; i ++)
        if(!used[i])
            bits[i] = x;
}

void exploreCave(int n){
    for(int i = 0; i < n; i ++){
        int l = 0, r = n - 1;
        int x = -1;
        while(l < r){
            int m = (l + r) >> 1;
            if(check(l, m))
                l = m + 1;
            else if(check(m + 1, r))
                r = m;
            else{
                color(l, m, 0);
                color(m + 1, r, 1);
                int k = tryCombination(bits);
                if(x == -1){
                    if(k > i or k == -1){
                        color(m + 1, r, 0);
                        int k = tryCombination(bits);
                        if(k > i or k == -1)
                            x = 0, r = m;
                        else
                            x = 1, l = m + 1;
                    }
                    else{
                        color(m + 1, r, 0);
                        int k = tryCombination(bits);
                        if (k > i or k == -1)
                            x = 0, l = m + 1;
                        else
                            x = 1, r = m;
                    }
                }
                else{
                    if(k > i or k == -1)
                        l = m + 1;
                    else
                        r = m;
                }
            }
        }
        if(i == n - 1){
            color(0, n - 1, 0);
            x = 0;
            if(tryCombination(bits) != -1)
                x = 1;
        }
        used[l] = true;
        bits[l] = x;
        a[l] = i;
    }
    answer(bits, a);
}

Compilation message (stderr)

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