Submission #168573

#TimeUsernameProblemLanguageResultExecution timeMemory
168573nickmet2004동굴 (IOI13_cave)C++11
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
//#include"cave.h"

using namespace std;

int N;
vector<int> explored;
vector<int> Switch , D;

void change(int x , int y){
    while(x <= y){
        if(!explored[x]){
            Switch[x] = (Switch[x] + 1) % 2;
        }
        ++x;
    }
}
void open(int idx){
    int l = 0; int r = n - 1;
    int ret , s1 , s2;
    ret = tryCombination(Switch);
    s1 = (ret > idx) || (ret == -1) ? 0 : 1;

    while(l <= r){
        int mid = (l + r) >> 1;
        change(l , mid);
        ret = tryCombination(Switch);
        s2 = (ret > idx) || (ret == -1) ? 0 : 1;
        if(s1 != s2){
            r = mid - 1;
        } else {
            l = mid;
        }
    }
    Switch[l] = s1;
    D[l] = idx;
    explored[idx] = 1;
}
void exploreCave(int N){
    N = n;
    for(int i = 0; i < N; ++i){
        open(i);
    }
    answer(Switch , D);
}

Compilation message (stderr)

cave.cpp: In function 'void open(int)':
cave.cpp:19:24: error: 'n' was not declared in this scope
     int l = 0; int r = n - 1;
                        ^
cave.cpp:21:11: error: 'tryCombination' was not declared in this scope
     ret = tryCombination(Switch);
           ^~~~~~~~~~~~~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:40:9: error: 'n' was not declared in this scope
     N = n;
         ^
cave.cpp:44:5: error: 'answer' was not declared in this scope
     answer(Switch , D);
     ^~~~~~
cave.cpp:44:5: note: suggested alternative: 'assert'
     answer(Switch , D);
     ^~~~~~
     assert