Submission #247057

#TimeUsernameProblemLanguageResultExecution timeMemory
247057arborCave (IOI13_cave)C++14
0 / 100
188 ms504 KiB
#include "cave.h" #include <bits/stdc++.h> bool done[5005]; int get(int S[]) { int ret = tryCombination(S); if (ret == -1) ret = 5001; return ret; } void exploreCave(int N) { int s[N], d[N]; for (int i = 0; i < N; i++) { int l = 0, r = N - 1; // assume doors [0, i-1] are already open bool state = get(s) == i; while (l <= r) { int m = (l + r) / 2; for (int j = l; j <= m; j++) if (!done[j]) s[j] = state; int idx = get(s); for (int j = l; j <= m; j++) if (!done[j]) s[j] = 0; if (idx == i) l = m + 1; else r = m - 1; } s[l] = state; d[l] = i; done[l] = true; } 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...