Submission #376121

#TimeUsernameProblemLanguageResultExecution timeMemory
376121gustasonCave (IOI13_cave)C++14
100 / 100
389 ms656 KiB
#include "cave.h" void exploreCave(int N) { int S[N], D[N]; for(int i = 0; i < N; i++) { S[i] = 0; D[i] = -1; } for(int i = 0; i < N; i++) { int x = tryCombination(S); if (x <= i && x != -1) { for(int j = 0; j < N; j++) { if (D[j] != -1) continue; S[j] ^= 1; } } int l = 0, r = N-1, ans = r; while(l <= r) { int mid = (l + r) / 2; for(int j = l; j <= mid; j++) { if (D[j] != -1) continue; S[j] ^= 1; } x = tryCombination(S); if (x <= i && x != -1) { r = mid - 1; ans = mid; } else { l = mid + 1; } for(int j = l; j <= mid; j++) { if (D[j] != -1) continue; S[j] ^= 1; } } D[ans] = i; // S[ans] ^= 1; } 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...