# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
231398 | Tehillah | Cave (IOI13_cave) | C++14 | 7 ms | 384 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "cave.h"
#define REP(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
void exploreCave(int N) {
int S[N], D[N];
for(int i=0; i<N; ++i) S[i] = 1;
int ret;
while(1) {
ret = tryCombination(S);
int end = ret;
if(ret == -1) end = N;
int p = end;
REP(i, 0, N) {
//flip ith switch
S[i] = !S[i];
ret = tryCombination(S);
if(ret < end) {
D[i] = ret;
S[i] = !S[i];
--p;
} else if(ret == end) {
D[i] = ret;
--p;
} else
S[i] = !S[i];
if(p == 0) break;
}
if(end == N) break;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |