제출 #413889

#제출 시각아이디문제언어결과실행 시간메모리
413889LouayFarah동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h" #include "cave.h" using namespace std; int tryCombination(int S[]); void answer(int S[], int D[]); void exploreCave(int N) { int S[N]; int D[N]; visited.assign(N, false); opened.assign(N, false); for(int i = 0; i<N; i++) { S[i] = 0; D[i] = i; } int res = 0; int door = 0; while(door<N) { res = tryCombination(S); if(res==-1) { for(int i = 0; i<N; i++) { S[i] = 1 - S[i]; int d = tryCombination(S); S[i] = 1 - S[i]; D[i] = d; } answer(S, D); } for(int i = 0; i<N; i++) { if(!visited[i]) { S[i] = 1 - S[i]; int curr = tryCombination(S); S[i] = 1 - S[i]; if(curr==-1) { S[i] = 1 - S[i]; break; } if(curr<res&&(!opened[curr])) { D[i] = curr; visited[i] = true; opened[curr] = true; } else if(curr>res) { D[i] = res; S[i] = 1 - S[i]; visited[i] = true; opened[res] = true; break; } } } door++; } answer(S, D); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:12:5: error: 'visited' was not declared in this scope
   12 |     visited.assign(N, false);
      |     ^~~~~~~
cave.cpp:13:5: error: 'opened' was not declared in this scope
   13 |     opened.assign(N, false);
      |     ^~~~~~