# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
81072 | arman_ferdous | Cave (IOI13_cave) | C++17 | 372 ms | 548 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 <bits/stdc++.h>
#include "cave.h"
using namespace std;
void exploreCave(int N) {
int S[N], D[N];
memset(S,0,sizeof S);
memset(D,-1,sizeof D);
for(int i = 0; i < N; i++) {
int bad = tryCombination(S);
int stat = (bad == i);
int lo = 0, hi = N-1, idx;
while(lo <= hi) {
int mid = (lo + hi) >> 1;
for(int i = lo; i <= mid; i++) if(D[i] == -1) S[i] ^= 1;
int blok = tryCombination(S);
for(int i = lo; i <= mid; i++) if(D[i] == -1) S[i] ^= 1;
if(stat == 0) {
if(blok == i) idx = mid, hi = mid-1;
else lo = mid+1;
} else {
if(blok > i || blok == -1) idx = mid, hi = mid-1;
else lo = mid+1;
}
}
D[idx] = i;
S[idx] = stat;
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... |