# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
231068 | Tehillah | 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 <vector>
#include <set>
using namespace std;
void exploreCave(int N) {
vector<int> S(N, 1), D(N);
int ret;
while(1) {
ret = tryCombination(S);
if(ret == -1) break;
else S[ret] = !S[ret];
}
set<int> st;
for(int i=0; i<N; ++i) {
//closing 'i'th door
S[i] = !S[i];
ret = tryCombination(S);
assert(ret != -1);
D[i] = ret;
st.insert(ret);
//open 'i'th door
S[i] = !S[i];
}
assert((int)st.size() == N);
answer(S, D);
return;
}