Submission #759805

#TimeUsernameProblemLanguageResultExecution timeMemory
759805raysh07Cave (IOI13_cave)C++17
0 / 100
434 ms372 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; void exploreCave(int N) { int n = N; bool fixed[n]; int con[n]; for (int i = 0; i < n; i++) fixed[i] = false; int ans[n]; int v; for (int i = 0; i < n; i++){ //try all 0s for (int j = 0; j < n; j++){ if (!fixed[j]) con[j] = 0; } v = tryCombination(con); int got = 1; if (v >= i + 1) got = 0; int l = 0, r = n - 1; while (r != l){ int m = (l + r)/2; //check if answer is among [l, mid] for (int j = 0; j < n; j++) { if (fixed[j]) continue; if (j >= l && j <= m) con[j] = got; else con[j] = got ^ 1; } v = tryCombination(con); if (v >= i + 1) r = m; else l = m + 1; } con[l] = got; fixed[l] = true; ans[l] = i; } answer(con, 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...