Submission #206554

#TimeUsernameProblemLanguageResultExecution timeMemory
206554spdskatrCave (IOI13_cave)C++14
100 / 100
1185 ms588 KiB
#include "cave.h" #include <cstdio> int comb[5005], S[5005], D[5005]; void exploreCave(int N) { for (int i = 0; i < N; i++) D[i] = -1; for (int i = 0; i < N; i++) { // Finding switch for door i // Set all unset swtches to 1 for (int j = 0; j < N; j++) { if (D[j] >= 0) comb[j] = S[j]; else comb[j] = 1; } int d = tryCombination(comb); int state = d == -1 || d > i; int val = 0; for (int b = 0; b < 13; b++) { for (int j = 0; j < N; j++) { if (D[j] >= 0) comb[j] = S[j]; else if ((j >> b) & 1) comb[j] = state; else comb[j] = !state; } int res = tryCombination(comb); if (res == -1 || res > i) val |= (1 << b); } D[val] = i; S[val] = state; } 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...