제출 #593282

#제출 시각아이디문제언어결과실행 시간메모리
593282gortomiCave (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
void exploreCave(int n);
void exploreCave(int n)
{
    int position[n];
    for(int i = 0; i < n; i++) position[i] = -1;
    vector<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 = l; j <= mid / 2; j++) guess[j] = position[j] == -1 ? position[i] : position[j];
            for(int j = mid + 1; j <= r; 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);
    }
}

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:13:17: error: 'tryCombination' was not declared in this scope
   13 |         int x = tryCombination(guess);
      |                 ^~~~~~~~~~~~~~
cave.cpp:28:9: error: 'answer' was not declared in this scope
   28 |         answer(position, ans);
      |         ^~~~~~