# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
350074 | tjrwodnjs999 | Cave (IOI13_cave) | C++11 | 236 ms | 620 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;
void exploreCave(int N) {
int arr[N],pos[N],qry[N];
fill(arr,arr+N,-1);
for(int i=0;i<N;i++){
vector<int> vt;
for(int j=0;j<N;j++){
if(arr[j]==-1) vt.push_back(j);
else qry[j]=pos[j];
}
int cur;
for(int j:vt) qry[j]=0;
int tr=tryCombination(qry);
if(tr>=i) cur=0;
else cur=1;
for(int j:vt) qry[j]=1-cur;
int l=0,r=vt.size()-1;
while(l<=r){
if(l==r) {arr[l]=i,pos[l]=cur;break;}
int mid=l+r>>1;
for(int i=l;i<=mid;i++) qry[vt[i]]=cur;
int ans=tryCombination(qry);
for(int i=l;i<=mid;i++) qry[vt[i]]=1-cur;
if(ans>=i) r=mid;
else l=mid+1;
}
}
answer(pos,arr);
}
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... |