# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
916732 | Warinchai | Cave (IOI13_cave) | C++14 | 110 ms | 564 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>
using namespace std;
int sans[5005];
int dans[5005];
int isans[5005];
int temp[5005];
vector<int>v;
/*void answer(int s[],int d[]){
for(int i=0;i<s.size();i++)cout<<s[i]<<" ";
cout<<"\n";
for(int i=0;i<d.size();i++)cout<<d[i]<<" ";
}*/
void exploreCave(int N) {
int ans[N]={};
int door[N]={};
for(int i=0;i<N;i++){
for(int j=0;j<N;j++)temp[j]=0;
for(int j=0;j<N;j++){
if(isans[j])temp[j]=ans[j];
}
int on;
if(tryCombination(temp)==i)on=1;
else on=0;
v.clear();
for(int i=0;i<N;i++)if(isans[i])v.push_back(i);
int st=0,en=v.size();int pos=0;
while(st<=en){
int m=(st+en)/2;
for(int j=0;j<v.size();j++){
temp[v[j]]=on^1;
}
for(int j=0;j<m;j++){
temp[v[j]]=on;
}
if(tryCombination(temp)<=i){
pos=m-1;
en=m-1;
}else{
st=m+1;
}
}
isans[pos]=1;
ans[pos]=on;
door[i]=pos;
}
answer(ans,door);
/* ... */
}
/*int main(){
int n;
cin>>n;
for(int i=0;i<n;i++)cin>>sans[i];
for(int i=0;i<n;i++)cin>>dans[i];
exploreCave(n);
}*/
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... |