Submission #1132210

#TimeUsernameProblemLanguageResultExecution timeMemory
1132210totoroCave (IOI13_cave)C++20
33 / 100
26 ms332 KiB
#include "cave.h" #include <vector> #include <stdlib.h> #include <cassert> void exploreCave(int N) { int* comb = (int*)calloc(N, sizeof(int)); int* fixed = (int*)calloc(N, sizeof(int)); int cnt = 0; while (cnt < N) { int t = tryCombination(comb); if (t == -1) t = N; assert(t >= cnt); if (t > cnt) { int i = 0; while (t > cnt) { if (fixed[i]) {++i; continue;} comb[i] ^= 1; t = tryCombination(comb); if (t == -1) t = N; ++i; } --i; ++cnt; fixed[i] = cnt; comb[i] ^= 1; } else { int i = 0; while (t == cnt) { if (fixed[i]) {++i; continue;} comb[i] ^= 1; t = tryCombination(comb); if (t == -1) t = N; ++i; } --i; ++cnt; fixed[i] = cnt; } } for (int i = 0; i < N; ++i) { --fixed[i]; } answer(comb, fixed); }
#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...