제출 #1099714

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

void exploreCave(int N){
    vector<int>test(N),lock(N),pos(N),D(N);
    for(int i=0; i<N; i++){
        lock[i] = -1;
    }
    for(int i=0; i<N; i++){
        int thisans;
        for(int j=0; j<N; j++){
            if(lock[j]!=-1)test[j] = lock[j];
            else test[j] = 0;
        }
        int door = tryCombination(test);
        thisans = (door == i);
        int l=0,r=N-1;
        while(l<r){
            int mid=(l+r)/2;
            for(int j=i; j<=mid; j++){
                if(lock[j]!=-1)test[j] = lock[j];
                else test[j] = 0;
            }
            for(int j=mid+1; j<=r; j++){
                if(lock[j]!=-1)test[j] = lock[j];
                else test[j] = 1;
            }
            door = tryCombination(test);
            if(door > i){
                if(!thisans){
                    r=mid;
                }
                else{
                    l=mid+1;
                }
            }
            else{
                if(!thisans){
                    l=mid+1;
                }
                else{
                    r=mid;
                }
            }
        }
        pos[i]=l;
        lock[l]=thisans;
    }
    for(int i=0; i<N; i++){
        D[pos[i]]=i;
    }
    answer(lock,D);
}

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:15:20: error: 'tryCombination' was not declared in this scope
   15 |         int door = tryCombination(test);
      |                    ^~~~~~~~~~~~~~
cave.cpp:52:5: error: 'answer' was not declared in this scope
   52 |     answer(lock,D);
      |     ^~~~~~