제출 #258409

#제출 시각아이디문제언어결과실행 시간메모리
258409SpeedOfMagic동굴 (IOI13_cave)C++17
0 / 100
175 ms640 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; void exploreCave(int N) { vector<int> switches; for (int i = 0; i < N; ++i) switches.push_back(i); int correct[N]; int perm[N]; for (int i = 0; i < N; ++i) correct[i] = 0; int current = tryCombination(correct); for (int i = 1; i <= N; ++i) { if (current == i) { for (int j : switches) correct[j] = 1; current = tryCombination(correct); assert(current > i); } int l = 0, r = switches.size() - 1; while (l < r) { int mid = (l + r) >> 1; for (int i = l; i <= mid; ++i) correct[switches[i]] = 1 - correct[switches[i]]; int pos = tryCombination(correct); for (int i = l; i <= mid; ++i) correct[switches[i]] = 1 - correct[switches[i]]; if (pos == i) { r = mid; } else { l = mid + 1; } } perm[switches[l]] = i - 1; switches.erase(switches.begin() + l); } answer(correct, perm); }
#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...