Submission #97984

#TimeUsernameProblemLanguageResultExecution timeMemory
97984AlexLuchianovCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include <iostream> //#include "cave.h" using namespace std; /* void answer(int S[], int D[], int n){ for(int i = 0 ; i < n; i++) cout << S[i] << " "; cout << '\n'; for(int i = 0 ; i < n; i++) cout << D[i] << " "; } int tryCombination(int S[], int n) { for(int i = 0; i < n; i++) cout << S[i] << " "; cout << '\n'; int ans; cin >> ans; return ans; } //*/ void exploreCave(int n) { int door[n] = {0}, per[n] = {0}, seen[n] = {0}; for(int i = 0; i < n; i++){ int from = 0, to = n - 1; int val = tryCombination(door); if(i < val || val == -1) for(int j = 0; j < n; j++) if(seen[j] == 0) door[j] ^= 1; while(from < to){ int mid = (from + to) / 2; for(int j = 0; j <= mid; j++) if(seen[j] == 0) door[j] ^= 1; int val = tryCombination(door); if(i < val || val == -1){ to = mid; } else from = mid + 1; for(int j = 0; j <= mid; j++) if(seen[j] == 0) door[j] ^= 1; } door[from] ^= 1; per[from] = i; seen[from] = 1; } answer(door, per); } int main(){ exploreCave(4); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:32:15: error: 'tryCombination' was not declared in this scope
     int val = tryCombination(door);
               ^~~~~~~~~~~~~~
cave.cpp:57:3: error: 'answer' was not declared in this scope
   answer(door, per);
   ^~~~~~