# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
120003 | nxteru | Cave (IOI13_cave) | C++14 | 0 ms | 0 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 n,ans[5005],k,s[5005];
void exploreCave(int N) {
n=N;
for(int i=0;i<n;i++)ans[i]=-1,x.PB(i);
while(1){
vector<int>x;
for(int i=0;i<n;i++)if(ans[i]==-1)x.PB(i);
if(x.size()==0)break;
int p=tryCombination(s);
if(p==-1||p>k)p=1;
else p=0;
while(x.size()>1){
for(int i=0;i<x.size()/2;i++)s[x[i]]^=1;
int 1=tryCombination(s);
if(1==-1||q>k)q=1;
else q=0;
vector<int>y;
if(p==q)for(int i=x.size()/2;i<x.size();i++)y.PB(x[i]);
else for(int i=0;i<x.size()/2;i++)y.PB(x[i]);
x.clear();
for(int i=0;i<y.size();i++)x.PB(y[i]);
p=q;
}
ans[x[i]]=k++;
if(p==0)s[x[i]]^=1;
}
answer(s,ans);
}