Submission #1105478

#TimeUsernameProblemLanguageResultExecution timeMemory
1105478lkaterisCave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include "cave.h" #include <iostream> using namespace std; bool vis[5005]; vector<int> switches; int corr; void exploreCave(int N) { int S[N],D[N]; for(int i=0;i<N;++i) { switches.clear(); for(int j=0;j<N;++j) if (!vis[j]) switches.push_back(j); for(int j=0;j<N-i;++j) S[switches[j]] = 0; if (tryCombinations(S) == i) corr = 1; else corr = 0; for(int j=0;j<N-i;++j) S[switches[j]] = corr^1; int l = 0; int r = N-i-1; while (l < r) { int mid = (l+r)/2; for (int j=l; j <= mid; ++j) S[switches[j]] = corr; int f = tryCombination(S); for (int j=l; j <= mid; ++j) S[switches[j]] = corr^1; if (f == i) l = mid+1; else r = mid; } vis[switches[l]] = true; S[switches[l]] = corr; D[switches[l]] = i; } answer(S,D); }

Compilation message (stderr)

cave.cpp:7:1: error: 'vector' does not name a type
    7 | vector<int> switches;
      | ^~~~~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:14:13: error: 'switches' was not declared in this scope
   14 |             switches.clear();
      |             ^~~~~~~~
cave.cpp:17:17: error: 'tryCombinations' was not declared in this scope; did you mean 'tryCombination'?
   17 |             if (tryCombinations(S) == i) corr = 1;
      |                 ^~~~~~~~~~~~~~~
      |                 tryCombination