Submission #821331

#TimeUsernameProblemLanguageResultExecution timeMemory
821331annabeth9680Cave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; const int MAXN = 5010; bool vis[MAXN]; int S[MAXN],match[MAXN]; void exploreCave(int N){ for(int i = 0;i<N;++i){ if(tryCombination(S) == i){ //this means that it should be all 1's instead of 0's for(int j = 0;j<N;++j){ if(!vis[j]) S[j] = !S[j]; } } int lo = 0, hi = N-1; while(lo < hi){ int mid = (lo+hi)/2; for(int j = lo;j<=mid;++j){ if(!vis[j]) S[j] = !S[j]; } if(tryCombination(S) == i) r = mid; else lo = mid+1; for(int j = lo;j<=mid;++j){ if(!vis[j]) S[j] = !S[j]; } } vis[lo] = true; match[lo] = i; } answer(S,match); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:19:40: error: 'r' was not declared in this scope
   19 |             if(tryCombination(S) == i) r = mid;
      |                                        ^