# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
882324 | dubabuba | 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>
const int mxn = 5050;
void exploreCave(int N) {
int d[N], id[N];
for(int i = 0; i < N; i++)
id[i] = i;
memset(d, d[N]);
auto rev = [&](int l, int r) {
for(int i = l; i <= r; l++)
d[i] = 1 - a[i];
};
int las = -1;
while(1) {
int i = tryCombination(d);
if(i == -1) break;
las = max(las, i);
rev(las + 1, N - 1);
int j = tryCombination(d);
if(j == -1) break;
las = j + 1;
d[j + 1] = 1 - d[j + 1];
}
answer(d, id);
}