Submission #66385

#TimeUsernameProblemLanguageResultExecution timeMemory
66385zubecCave (IOI13_cave)C++14
100 / 100
366 ms636 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; int n, a[5100], b[5100]; bool used[5100]; void xr(int l, int r){ for (int i = l; i <= r; i++) if (!used[i]) a[i] ^= 1; } void open(int i){ int num = tryCombination(a); int need = ((num > i || num == -1) ? 1 : 0); int l = 0, r = n-1; while (l < r){ int mid = (l+r)>>1; xr(l, mid); int num = tryCombination(a); int cur = ((num > i || num == -1) ? 1 : 0); xr(l, mid); if (cur == need) l = mid+1; else r = mid; } a[l] = need^1; b[l] = i; used[l] = 1; } void exploreCave(int N) { n = N; for (int i = 0; i < n; i++){ open(i); } answer(a, b); }
#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...