#include <bits/stdc++.h>
#define pii pair<int, int>
#define tii tuple<int, int, int>
#define lli long long
// #define f first
// #define s second
#define pb push_back
using namespace std;
#include "cave.h"
// void exploreCave(int n);
// void answer(int S[],int D[]);
// int tryCombination(int S[]);
void exploreCave(int n){
int s[n], d[n];
for (int i=0; i<n; i++){
d[i]=-1;
}
// vector<int> s(n), d(n, -1);
int c = 0;
int f1 = tryCombination(s);
int f2 = f1;
int last = -1;
while(f2!=n){
while(f1==f2){
while(d[last]!=-1){
last++;
last=last%n;
}
s[last]=1-s[last];
f2 = tryCombination(s);
}
if(f2==-1)f2=n;
if(f1<f2){
d[f1]=last;
c++;
}else{
d[f2]=last;
s[f2]=1-s[f2];
c++;
}
f1=f2;
}
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... |