# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
414666 | hibye1217 | Cave (IOI13_cave) | C++17 | 367 ms | 452 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.
#ifndef NOTSUBMIT
#include <bits/stdc++.h>
#include "cave.h"
using namespace std;
#endif // NOTSUBMIT
void exploreCave(int N) {
int flp[5020] = {};
int dor[5020] = {};
bool chk[5020] = {};
for (int i = 0; i < N; i++){
int st = 0, ed = N-1;
int res1 = tryCombination(flp);
while (st < ed){
int mid = st + ed >> 1;
for (int j = st; j <= mid; j++){
if (chk[j]){ continue; }
flp[j] ^= 1;
}
int res2 = tryCombination(flp);
for (int j = st; j <= mid; j++){
if (chk[j]){ continue; }
flp[j] ^= 1;
}
if ( (res1==i) ^ (res2==i) ){ ed = mid; }
else{ st = mid+1; }
}
int ptr = st;
dor[ptr] = i; chk[ptr] = 1;
if (res1 == i){ flp[ptr] = 1; }
}
answer(flp, dor);
}
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... |