제출 #1313387

#제출 시각아이디문제언어결과실행 시간메모리
1313387shirokito동굴 (IOI13_cave)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define all(a) (a).begin(), (a).end() #define fi first #define se second using ll = long long; const int N = 5000 + 24; void exploreCave(int N) { int n = N; vector<int> state(n, 0), can(n, 1); for (int i = 0; i < n; i++) { int k = tryCombination(state); int m = tryCombination(can); if (m != -1 && m < k) { int pos = -1; for (int l = 0, r = n - 1; l <= r; ) { int mid = (l + r) >> 1; vector<int> new_state = state; for (int i = 0; i <= mid; i++) { if (can[i]) new_state[i] = 1; } int jury_ans = tryCombination(new_state); if (jury_ans != -1 && jury_ans < k) { pos = mid; r = mid - 1; } else l = mid + 1; } if (pos != -1) { can[pos] = 0; // cout << "POS = " << pos << "\n"; } } else { int pos = -1; for (int l = 0, r = n - 1; l <= r; ) { int mid = (l + r) >> 1; vector<int> new_state = state; for (int i = 0; i <= mid; i++) { if (can[i]) new_state[i] = 1; } int jury_ans = tryCombination(new_state); if (jury_ans == -1 || jury_ans > k) { pos = mid; r = mid - 1; } else l = mid + 1; } if (pos != -1) { // cout << "POS = " << pos << "\n"; state[pos] = 1; } } } vector<int> d(n); for (int i = 0; i < n; i++) { vector<int> new_state = state; new_state[i] ^= 1; d[i] = tryCombination(new_state); } return answer(state, d); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:18:17: error: 'tryCombination' was not declared in this scope
   18 |         int k = tryCombination(state);
      |                 ^~~~~~~~~~~~~~
cave.cpp:81:16: error: 'tryCombination' was not declared in this scope
   81 |         d[i] = tryCombination(new_state);
      |                ^~~~~~~~~~~~~~
cave.cpp:84:12: error: 'answer' was not declared in this scope
   84 |     return answer(state, d);
      |            ^~~~~~