제출 #52123

#제출 시각아이디문제언어결과실행 시간메모리
52123rondojim동굴 (IOI13_cave)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; const int MAXN = 5e3 + 5; int st[MAXN], con[MAXN], cnt; int tryCombination(int S[]); void answer(int S[], int D[]); void solve(int ret){ int lo = 1, hi = N, mid, res, r; while(lo <= hi){ mid = (lo + hi)>>1; for(int i=1; i<=mid; ++i) st[i] ^= 1; r = tryCombination(st); for(int i=1; i<=mid; ++i) st[i] ^= 1; if(r != ret) hi = mid - 1, res = mid; else lo = mid + 1; } st[res] ^= 1; } void exploreCave(int N){ while(true){ int ret = tryCombination(st); if(ret == -1){ for(int i=1; i<=N; ++i){ st[i] ^= 1; con[i] = tryCombination(st); st[i] ^= 1; } break; } solve(ret); } }

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

cave.cpp: In function 'void solve(int)':
cave.cpp:13:19: error: 'N' was not declared in this scope
  int lo = 1, hi = N, mid, res, r;
                   ^
cave.cpp:15:3: error: 'mid' was not declared in this scope
   mid = (lo + hi)>>1;
   ^~~
cave.cpp:17:3: error: 'r' was not declared in this scope
   r = tryCombination(st);
   ^
cave.cpp:19:30: error: 'res' was not declared in this scope
   if(r != ret) hi = mid - 1, res = mid;
                              ^~~
cave.cpp:19:30: note: suggested alternative: 'ret'
   if(r != ret) hi = mid - 1, res = mid;
                              ^~~
                              ret
cave.cpp:22:5: error: 'res' was not declared in this scope
  st[res] ^= 1;
     ^~~
cave.cpp:22:5: note: suggested alternative: 'ret'
  st[res] ^= 1;
     ^~~
     ret