Submission #380658

#TimeUsernameProblemLanguageResultExecution timeMemory
380658WLZCave (IOI13_cave)C++14
100 / 100
314 ms876 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; void exploreCave(int N) { int S[N], D[N]; vector<int> left(N); iota(left.begin(), left.end(), 0); for (int i = 0; i < N; i++) { for (auto& x : left) S[x] = 1; int b = tryCombination(S) == i; for (auto& x : left) S[x] = !b; int lo = 0, hi = (int) left.size() - 1; while (lo < hi) { int mid = lo + (hi - lo) / 2; for (int j = lo; j <= mid; j++) S[left[j]] = b; if (tryCombination(S) == i) hi = mid; else lo = mid + 1; for (int j = lo; j <= mid; j++) S[left[j]] = !b; } S[left[lo]] = !b; D[left[lo]] = i; left.erase(left.begin() + lo); } 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...