# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
230050 | chubyxdxd | Cave (IOI13_cave) | C++11 | 1030 ms | 632 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"
#include <bits/stdc++.h>
#define test tryCombination
using namespace std;
void exploreCave(int N) {
int door[N],ans[N],vis[N];
for(int i=0;i<N;i++){
ans[i]=1;
door[i]=-1;
vis[i]=1;
}
//int curr=test(ans);
// cout<<curr<<endl;
for(int i=0;i<N;i++){
for(int j=0;j<N;j++){
if(vis[j]==1)ans[j]=1;
}
int h=test(ans);
int sw=0;
if(h==i){
sw=1;
}
//cout<<"gg=="<<sw<<endl;
for(int j=0;j<N;j++){
if(vis[j]==1)ans[j]=sw;
}
int lo=0,hi=N-1,r;
while(lo<hi){
for(int j=0;j<N;j++){
if(vis[j]==1)ans[j]=sw;
}
int mid=(lo+hi)/2;
for(int j=lo;j<=mid;j++){
if(vis[j]==1)ans[j]^=1;
}
r=test(ans);
//cout<<r<<endl;
if(r==i){
lo=mid+1;
}
else{
hi=mid;
}
//cout<<lo<<" "<<hi<<endl;
}
door[lo]=i;
vis[lo]=-1;
if(r==i)ans[lo]^=1;/*
cout<<lo<<" -< "<<endl;
cout<<"swich"<<endl;
for(int j=0;j<N;j++){
cout<<ans[j]<<" ";
}
cout<<endl;
cout<<"door"<<endl;
for(int j=0;j<N;j++){
cout<<door[j]<<" ";
}
cout<<endl;
cout<<"off"<<endl;
for(int j=0;j<N;j++){
cout<<vis[j]<<" ";
}
cout<<endl;*/
}
answer(ans,door);
}
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... |