# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
383496 | nicholask | 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 <bits/stdc++.h>
#include "cave.h"
using namespace std;
void exploreCave(int N){
int s[N],d[N];
for (int i=0; i<N; i++){
s[i]=0;
d[i]=-1;
}
for (int i=0; i<N; i++){
vector <int> v;
for (int j=0; j<N; j++){
if (d[j]==-1) v.push_back(j);
}
while (v.size()>1){
int mid=v.size()/2;
vector <int> l,r;
for (int j=0; j<v.size(); j++){
if (i<mid) l.push_back(v[i]);
else r.push_back(v[i]);
}
for (auto&j:l) s[j]=1;
if (tryCombination(S)==i) v=l;
else v=r;
for (auto&j:l) s[j]=0;
}
if (tryCombination(S)==i) s[v[0]]=1;
d[v[0]]=i;
}
answer(s,d);
}