제출 #1218803

#제출 시각아이디문제언어결과실행 시간메모리
1218803nickolasarapidis동굴 (IOI13_cave)C++20
컴파일 에러
0 ms0 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 5000; int S[MAXN], D[MAXN], B[MAXN]; // 0 up 1 down int first, M; void finish(){ for(int i = 0; i < M; i++){ if(B[i] == 1) continue; S[i] = 1; int f = tryCombination(S); D[i] = f; S[i] = 0; } answer(S, D); } void solve(int l, int r){ if(l == r){ S[l] = 1; int f = tryCombination(S); if(f == -1){ B[l] = 1; D[l] = first; finish(); } if(f < first){ S[l] = 0; B[l] = 1; D[l] = f; } if(f > first){ B[l] = 1; D[l] = first; first = f; } else if(f == first){ S[l] = 0; } return; } int m = (l + r)/2; solve(l, m); solve(m + 1, r); for(int i = l; i <= r; i++){ if(B[i]) continue; S[i] = 1; int f = tryCombination(S); if(f == -1){ B[i] = 1; D[i] = first; finish(); } if(f < first){ S[i] = 0; B[i] = 1; D[i] = f; } if(f > first){ B[i] = 1; D[i] = first; first = f; } else if(f == first){ S[i] = 0; } } return; } void exploreCave(int N){ memset(S, 0, sizeof(S)); memset(B, 0, sizeof(B)); first = tryCombination(S); if(f == -1){ finish(); } M = N; solve(0, N - 1); int A[N], B[N]; for(int i = 0; i < N; i++){ A[i] = S[i]; B[i] = D[i]; } answer(A, B); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:79:12: error: 'f' was not declared in this scope
   79 |         if(f == -1){
      |            ^