Submission #1174868

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
11748682025-03-27 13:44:25trvhungCave (IOI13_cave)C++20
100 / 100
171 ms508 KiB
#include "cave.h"
void exploreCave(int N) {
int sw[N], fx[N], ofSw[N];
for (int i = 0; i < N; ++i)
fx[i] = -1;
for (int d = 0; d < N; ++d) {
for (int i = 0; i < N; ++i)
sw[i] = fx[i] == -1 ? 0 : fx[i];
int cur = (tryCombination(sw) == d);
int l = 0, r = N - 1;
while (l != r) {
int mid = (l + r) >> 1;
for (int i = l; i <= mid; ++i)
sw[i] = fx[i] == -1 ? 1 : fx[i];
int ask = (tryCombination(sw) == d);
for (int i = l; i <= mid; ++i)
sw[i] = fx[i] == -1 ? 0 : fx[i];
if (ask == cur)
l = mid + 1;
else
r = mid;
}
fx[l] = cur;
ofSw[l] = d;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...