Submission #662833

#TimeUsernameProblemLanguageResultExecution timeMemory
662833AlmaCave (IOI13_cave)C++17
0 / 100
354 ms460 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; const int MX = 5000; int S[MX], D[MX], A[MX]; void exploreCave(int N) { memset(S, 0, sizeof S); memset(D, -1, sizeof D); for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { if (D[j] != -1) { A[j] = S[D[j]]; } else { A[j] = 1; } } int ret = tryCombination(A); int target; if (ret == i) { target = 0; } else { target = 1; } int lo = 0, mid, res = -1, hi = N-1; while (lo <= hi) { mid = (lo+hi) / 2; for (int j = 0; j < N; j++) { if (D[j] != -1) continue; if (j < mid) { A[j] = target; } else { A[j] = 1 - target; } } ret = tryCombination(A); if (ret == i) { lo = mid+1; } else { res = mid; hi = mid-1; } } S[res] = target; D[i] = res; } 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...