Submission #764612

#TimeUsernameProblemLanguageResultExecution timeMemory
764612hfoliacotsCave (IOI13_cave)C++14
0 / 100
1 ms340 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; void exploreCave(int N) { int s[N], d[N]; vector<bool> vis(N, false); memset(s, 0, sizeof s); memset(d, 0, sizeof d); int pant, p = tryCombination(s); int l = 0, r = N-1, mid = (l+r)/2; for (int k = 0; k < N; k++) { while (l < r) { for (int i = l; i <= mid; i++) { if (!vis[i]) s[i] = !s[i]; } pant = p; p = tryCombination(s); if (p == k && pant == k) l = mid+1; else if (p != k && pant != k) l = mid+1; else r = mid; mid = (l+r)/2; } d[r] = k; vis[r] = true; if (p == k) s[r] = !s[r]; } answer(s, d); }
#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...