제출 #857477

#제출 시각아이디문제언어결과실행 시간메모리
857477chilinhxyzabc동굴 (IOI13_cave)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

void exploreCave(int n) {
    int s[n], d[n];
    for(int i = 0; i < n; i++) {
        s[i] = 1;
        d[i] = -1;
    }
    int curDoor = tryCombination(s);
    while(curDoor != -1) {
        int l = 0, r = n - 1, res = n - 1;
        while(l <= r) {
            int m = (l + r) / 2;
            s[m] = 1 - s[m];
            int door = tryCombination(s);
            if(door == curDoor) {
                r = m - 1;
            } else {
                res = m;
                l = m + 1;
            }
            s[m] = 1 - s[m];
        }
        d[res] = curDoor;
        s[res] = 1 - s[res];
        curDoor = tryCombination(s);
    }
    for(int i = 0; i < n; i++) {
        if(d[i] != -1)
            continue;
        s[i] = 1 - s[i];
        int door = tryCombination(s);
        d[i] = door;
        s[i] = 1 - s[i];
    }
    answer(s, d);
}

컴파일 시 표준 에러 (stderr) 메시지

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:10:19: error: 'tryCombination' was not declared in this scope
   10 |     int curDoor = tryCombination(s);
      |                   ^~~~~~~~~~~~~~
cave.cpp:37:5: error: 'answer' was not declared in this scope
   37 |     answer(s, d);
      |     ^~~~~~