# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
755285 | Godgift42 | 동굴 (IOI13_cave) | C++14 | 48 ms | 408 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"
using namespace std;
void exploreCave(int N) {
int s[N];
int d[N];
int c[N];
for(int i=0;i<N;i++){
s[i]=0;
c[N]=0;
}
for(int i=0;i<N;i++){
int e = tryCombination(s);
if(e<i){
for(int j=0;j<N;j++){
if(!c[j]){
if(s[j]==0) s[j]++;
else s[j]--;
}
}
}
int l=0;int r=N-1;
int pre=1;
int t;
while(l<r){
t=(l+r)/2;
for(int j=l;j<=t;j++){
if(!c[j]){
if(s[j]==0) s[j]++;
else s[j]--;
}
}
e = tryCombination(s);
if(e<i) e=0;
else e=1;
if((e==0 and pre==1) or (e==1 and pre==0)){
r=t;
if(l!=r) pre=e;
}
else{
l = t+1;
if(l!=r) pre=e;
}
}
d[t]=i;
c[t]=1;
if(e==0){
if(s[t]==0) s[t]++;
else s[t]--;
}
}
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... |