Submission #305191

#TimeUsernameProblemLanguageResultExecution timeMemory
305191TemmieCave (IOI13_cave)C++17
100 / 100
1397 ms788 KiB
#include <bits/stdc++.h> #include "cave.h" void exploreCave(int n) { int a[69420]; int ans[60420]; std::vector <int> b(n), vis(n, 0); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) if (!vis[j]) a[j] = 0; int cur = tryCombination(a); int now = cur == -1 || cur > i ? 0 : 1; int l = 0, r = n - 1; while (l <= r) { int mid = (l + r) >> 1; for (int j = 0; j < n; j++) if (!vis[j]) a[j] = j <= mid ? now : 1 - now; int comp = tryCombination(a); if (comp == -1 || comp > i) b[i] = mid, r = mid - 1; else l = mid + 1; } a[b[i]] = now; vis[b[i]] = 69; ans[b[i]] = i; } answer(a, ans); }
#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...