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;
#define designed ios_base::sync_with_stdio(0);
#define by cin.tie(0);
#define AndreasK cout.tie(0);
//#define int long long
#define ii pair <int, int>
#define vi vector <int>
#define iii pair <int, ii>
#define vii vector <ii>
#define vc vector <char>
#define vb vector <bool>
void exploreCave(int n) {
int s[n] = {}, d[n];
int x = tryCombination(s);
stack <int> st;
for (int c = 0; c < n; c++) {
s[c] ^= 1;
int prevx = x;
x = tryCombination(s);
if (x == -1)
x = 2 * n;
if (x < prevx) {
s[c] ^= 1;
}
else if (x == prevx) {
st.push(c);
}
else {
while (!st.empty()) {
prevx = x;
x = tryCombination(s);
if (x == -1)
x = 2 * n;
s[st.top()] ^= 1;
if (x > prevx) {
st.pop();
}
else {
s[st.top()] ^= 1;
break;
}
}
}
}
for (int c = 0; c < n; c++) {
s[c] ^= 1;
x = tryCombination(s);
s[c] ^= 1;
d[c] = x;
}
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... |