# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
80291 | giorgikob | Cave (IOI13_cave) | C++14 | 416 ms | 652 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>
int ans[50005],ans1[50005],S[50005],fix[50005];
void exploreCave(int N) {
for(int i=0;i<N;i++)
{
for(int j=0;j<N;j++)
if(fix[j]==1)
S[j]=ans[j];
else
S[j]=0;
int x=tryCombination(S);
bool k=false;//daxuruli
if(x==-1 || x>i)k=true;bool t=k;//ghia
int L=0,R=N-1,ind=0;
while(L<=R)
{
//if(i==7)cout<<L<<" "<<R<<endl;
int mid=(L+R)/2;
for(int j=L;j<=mid;j++)
if(fix[j]==0)
S[j]=1-S[j];
x=tryCombination(S);
bool w=false;//daxuruli
if(x==-1 || x>i)
w=true;//ghia
if(k!=w)
R=mid-1,ind=mid;
else
L=mid+1;
k=w;
}
ans1[ind]=i;fix[ind]=1;//cout<<ind<<" "<<
(t==true)?ans[ind]=0:ans[ind]=1;
//if(ans[i]!=0)ans[i]=0;
}
//for(int i=0;i<N;i++)
//cout<<ans1[i]<<" ";
answer(ans,ans1);
}
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... |