제출 #374988

#제출 시각아이디문제언어결과실행 시간메모리
374988Alex_tz307동굴 (IOI13_cave)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int NMAX = 8192; int states[NMAX], doors[NMAX], query_states[NMAX]; bool found[NMAX]; bool opens(int ans, int door) { if(ans == -1) return true; return ans > door; } void exploreCave(int N) { assert(N == n); for(int i = 0; i < N; ++i) { bool colour = true; for(int j = 0; j < N; ++j) if(found[j]) query_states[j] = states[j]; else query_states[j] = 0; int ans = tryCombination(query_states); if(opens(ans, i)) colour = false; int st = 0, dr = N - 1; while(st < dr) { int mid = (st + dr) >> 1; for(int j = 0; j < N; ++j) if(found[j]) query_states[j] = states[j]; else if(st <= j && j <= mid) query_states[j] = colour; else query_states[j] = colour ^ 1; int ans = tryCombination(query_states); if(opens(ans, i)) dr = mid; else st = mid + 1; } found[st] = true, states[st] = colour, doors[st] = i; } answer(states, doors); }

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

In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from cave.cpp:1:
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:16:17: error: 'n' was not declared in this scope
   16 |     assert(N == n);
      |                 ^
cave.cpp:24:19: error: 'tryCombination' was not declared in this scope
   24 |         int ans = tryCombination(query_states);
      |                   ^~~~~~~~~~~~~~
cave.cpp:46:5: error: 'answer' was not declared in this scope
   46 |     answer(states, doors);
      |     ^~~~~~