Submission #332056

#TimeUsernameProblemLanguageResultExecution timeMemory
332056shrek12357Cave (IOI13_cave)C++14
100 / 100
1219 ms636 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; void exploreCave(int N) { vector<int> state(N), connect(N, N); for (int i=0; i<N; i++) { vector<int> guess(N); for (int j=0; j<N; j++) { if (connect[j] < i) guess[j] = state[j]; } bool x = tryCombination(&guess[0]) == i; int l = 0, r = N; while (l < r) { int m = (l + r) / 2; for (int j=0; j<N; j++) { if (connect[j] < i) guess[j] = state[j]; else if (j < l || j >= r) guess[j] = 0; else guess[j] = j <= m; } bool y = tryCombination(&guess[0]) == i; if (x == y) l = m + 1; else r = m; } state[l] = x; connect[l] = i; } answer(&state[0], &connect[0]); }
#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...