# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
857519 | chilinhxyzabc | 동굴 (IOI13_cave) | C++17 | 79 ms | 524 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];
for(int i = 0; i < n; i++) {
s[i] = 0;
d[i] = -1;
}
for(int i = 0; i < n; i++) {
int curDoor = tryCombination(s);
if(curDoor == -1)
break;
else {
int l = i, r = n - 1, res;
while(l <= r) {
int m = (l + r) / 2;
s[m] = 1 - s[m];
int door = tryCombination(s);
if(curDoor == door) {
r = m - 1;
} else {
l = m + 1;
res = m;
}
s[m] = 1 - s[m];
}
d[res] = curDoor;
s[res] = 1 - s[res];
i = res;
}
}
for(int i = 0; i < n; i++) {
if(d[i] != -1)
continue;
s[i] = 1 - s[i];
int door = tryCombination(s);
d[i] = door;
s[i] = 1 - s[i];
}
answer(s, d);
}
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... |