Submission #318796

#TimeUsernameProblemLanguageResultExecution timeMemory
318796jerrymonkeyCave (IOI13_cave)C++14
0 / 100
517 ms612 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; void exploreCave (int N) { int known[N], correctSw[N]; for (int i = 0; i < N; i++) known[i] = -1; for (int i = 0; i < N; i++) { int segLen = pow(2, __lg(N - i - 1)); int output[N]; for (int i = 0; i < N; i++) output[i] = known[i]; int c = 0, pos = 0; for (int j = 0; j < N; j++) { if (output[j] == -1) output[j] = 0; } bool doorSw = 0; if (tryCombination(output) > i) doorSw = 0; else doorSw = 1; while (1) { for (int j = 0; j < N; j++) { if (output[j] == -1) { output[j] = ((c / segLen + doorSw) % 2); c++; } } if (!(tryCombination(output) > i)) pos = pos | (1 << __lg(segLen)); if (segLen == 1) break; segLen /= 2; } int k = 0; for (int j = 0; j < N; j++) { if (known[j] == -1) { if (k == pos) { known[j] = doorSw; correctSw[doorSw] = i; break; } k++; } } } answer(known, correctSw); }
#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...