#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
const int Inf = (int)2e9 + 7;
bool vst[5009];
void exploreCave(int N) {
int n = N;
int s[N], d[N];
for (int i=0; i<n; i++) s[i] = d[i] = 0;
while (true) {
int firstClosed = tryCombination(s);
if (firstClosed == -1) break;
for (int i=0; i<n; i++) {
if (vst[i]) continue;
s[i] ^= 1;
int pp = tryCombination(s);
if (pp == -1) pp = Inf;
if (pp > firstClosed) {
d[i] = firstClosed;
vst[i] = true;
break;
} else
s[i] ^= 1;
}
}
answer(s, d);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |