# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
223142 | aggu_01000101 | Cave (IOI13_cave) | C++14 | 48 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 <bits/stdc++.h>
#include "cave.h"
#define mid(l, u) ((l+u)/2)
#define test(a) tryCombination(a);
#define lchild(i) (i*2 + 1)
#define rchild(i) (i*2 + 2)
using namespace std;
void exploreCave(int n){
int currdoor = 0, l = 0, u = n-1;
bool change[n];
for(int i = 0;i<n;i++) change[i] = true;
int q[n];
int r;
int ans[n];
while(currdoor<n){
for(int i = 0;i<n;i++){
if(change[i]) q[i] = 1;
}//
r = test(q);
int req = r==currdoor;
int l = 0;
int u = n-1;
while(l<u){
int m = mid(l, u);
for(int i = l;i<=m;i++){
if(change[i]) q[i] = req;
}
for(int i = m+1;i<=u;i++){
if(change[i]) q[i] = req^1;
}
r = test(q);
if(r==currdoor){
u = m;
}
else{
l = m+1;
}
}
change[l] = false;
q[l] = req;
ans[l] = currdoor;
currdoor++;
}
answer(q, ans);
}
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... |