Submission #104674

#TimeUsernameProblemLanguageResultExecution timeMemory
104674ErkhemkhuuCave (IOI13_cave)C++17
0 / 100
296 ms460 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; #define n 5005 bool vis[n + 5]; int ind[n + 5], switches[n + 5]; void run(int l, int r, bool flag) { int i; for(i = l; i <= r; i++) if(!vis[i]) switches[i] = flag; return; } void exploreCave(int N) { memset(switches, 0, sizeof(switches)); memset(vis, false, sizeof(vis)); memset(ind, 0, sizeof(ind)); int i, l, r, mid; bool flag; for(i = 0; i < N; i++) { l = 0; r = N; flag = tryCombination(switches) == i; while(l + 1 < r) { int mid = (l + r) / 2; run(l, mid, flag); run(mid + 1, r, flag ^ 1); if(tryCombination(switches) == i) r = mid; else l = mid; } vis[i] = true; switches[i] = flag; ind[i] = l; } answer(switches, ind); return; }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:17:15: warning: unused variable 'mid' [-Wunused-variable]
  int i, l, r, mid;
               ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...