Submission #102932

#TimeUsernameProblemLanguageResultExecution timeMemory
102932wxh010910Cave (IOI13_cave)C++17
100 / 100
339 ms616 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; void exploreCave(int N) { int* S = new int[N]; int* D = new int[N]; for (int i = 0; i < N; ++i) { S[i] = 0; } vector<bool> done(N); for (int i = 0; i < N; ++i) { int last = tryCombination(S); int l = 0, r = N - 1; while (l < r) { int mid = (l + r) >> 1; for (int i = l; i <= mid; ++i) { if (!done[i]) { S[i] = !S[i]; } } int now = tryCombination(S); if ((last == i) == (now == i)) { l = mid + 1; } else { r = mid; } last = now; } if (last == i) { S[r] = !S[r]; } D[r] = i; done[r] = 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...