제출 #1221160

#제출 시각아이디문제언어결과실행 시간메모리
1221160FaresSTHCave (IOI13_cave)C++20
0 / 100
1 ms320 KiB
#include "bits/stdc++.h" #include "cave.h" using namespace std; void exploreCave(int n){ bool v[1001] = {0}; // safer size if n <= 1000 int s[1001] = {0}, d[1001] = {0}; int in = tryCombination(s); // get initial score once for (int i = 0; i < n; i++) { int l = 0, r = n - 1; while (l < r) { int m = (l + r) / 2; for (int j = l; j <= m; j++) if (!v[j]) s[j] = !s[j]; int cur = tryCombination(s); for (int j = l; j <= m; j++) if (!v[j]) s[j] = !s[j]; if (in != cur) r = m; else l = m + 1; } if (in == tryCombination(s)) s[l] = !s[l]; // re-check before flipping d[i] = l; v[l] = true; in = tryCombination(s); // update in after flipping } 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...