Submission #104676

#TimeUsernameProblemLanguageResultExecution timeMemory
104676ErkhemkhuuCave (IOI13_cave)C++17
0 / 100
252 ms512 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; while(l + 1 < r) { int mid = (l + r) / 2; run(l, mid, true); run(mid + 1, r, false); if(tryCombination(switches) == i) r = mid; else l = mid; run(l, mid, true); } vis[i] = true; ind[i] = r; } 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;
               ^~~
cave.cpp:18:7: warning: unused variable 'flag' [-Wunused-variable]
  bool flag;
       ^~~~
#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...