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>
using namespace std;
void exploreCave(int n) {
int v[n];
memset(v, 0, sizeof(v));
int res[n];
for(int i=0;i<n;i++){
res[i]=i;
}
int z=n*2,k;
while(z--){
k=tryCombination(v);
if(k==-1){
break;
}
v[k]^=1;
}
if(k==-1){
answer(v,res);
return;
}
memset(v, 0, sizeof(v));
memset(res, -1, sizeof(res));
for(int i = 0; i < n; i++){
int d = tryCombination(v);
if(d == -1) d = n;
for (int i = 0; i < n; i++)
{
v[i] ^= 1;
int a = tryCombination(v);
if(a == -1){
d = -1;
break;
}
if(a < d){
res[i] = a;
v[i] ^= 1;
}
if(a > d){
res[i] = d + 1;
d = a;
}
}
if(d == n) break;
}
answer(v,res);
}
# | 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... |