# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
470412 | PiejanVDC | Cave (IOI13_cave) | C++17 | 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;
void exploreCave(int n) {
vector<int>v(n,0),d(n);
int f = tryCombination(v);
vector<bool>mark(n,false);
while(true) {
bool g = false;
for(int i = 0 ; i < n ; i++) {
v[i]=1;
int com = tryCombination(v);
if(com == -1) {
g=true;
break;
}
if(com < f) {
v[i]=0;
d[i]=com;
mark[i]=true;
} else if(com > f) {
d[i]=f;
f=com;
mark[i]=true;
continue;
}
v[i]=0;
}
if(g) break;
}
for(int i = 0 ; i < n ; i++) {
if(mark[i]) continue;
v[i]=1;
int cnt = tryCombination(v);
d[i]=cnt;
}
answer(v,d);
}