제출 #992921

#제출 시각아이디문제언어결과실행 시간메모리
992921vjudge1동굴 (IOI13_cave)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "cave.h"
using namespace std;
// #define int long long
#define endl '\n'
#define F first
#define S second
#define pb push_back
#define all(a) a.begin(),a.end()
const int NN=1e6+50000;
const int MOD=1e9+7;
const int off=(1<<11);

#define ask(x) tryCombination(x);

void exploreCave(int N){
    int S[N]={},D[N]={};
    for(int i=0;i<n;i++){
        int x=ask(S);
        if(x<=i)x=1;
        else x=0;

        int l=i,r=N-1;
        while(l<=r){
            int md=(l+r)/2;
            for(int j=l;j<=md;j++)S[j]=1;
            for(int j=md+1;j<=r;j++)S[j]=0;
            int cur=ask(S);
            if(x==1){
                if(cur>i){
                    r=md;
                }
                else{
                    l=md+1;
                }
            }
            else{
                if(cur>i){
                    l=md+1;
                }
                else{
                    r=md;
                }
            }
        }
        D[l]=i;
        S[l]=x;
    }
    ans(S,D);

}
// signed main(){
//     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
// }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:18:19: error: 'n' was not declared in this scope
   18 |     for(int i=0;i<n;i++){
      |                   ^
cave.cpp:49:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   49 |     ans(S,D);
      |     ^~~
      |     abs