Submission #791969

#TimeUsernameProblemLanguageResultExecution timeMemory
791969t6twotwoCave (IOI13_cave)C++17
100 / 100
262 ms468 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; void exploreCave(int N) { int S[N], D[N], A[N]{}; fill(D, D + N, -1); for (int i = 0; i < N; i++) { bool f = tryCombination(A) == i; int l = 0, r = N - 1; while (l < r) { int m = (l + r) / 2; for (int j = l; j <= m; j++) { if (D[j] == -1) { A[j] ^= 1; } } bool g = tryCombination(A) == i; for (int j = l; j <= m; j++) { if (D[j] == -1) { A[j] ^= 1; } } if (f == g) { l = m + 1; } else { r = m; } } S[l] = i; D[l] = f; A[l] = f; } answer(D, S); }
#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...