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;
int tryCombination(int S[]);
void answer(int S[], int D[]);
vector<bool> visited;
void exploreCave(int N)
{
int S[N];
int D[N];
visited.assign(N, false);
for(int i = 0; i<N; i++)
{
S[i] = 0;
D[i] = i;
}
int res = 0;
int door = 0;
while(door<N)
{
res = tryCombination(S);
if(res==-1)
{
for(int i = 0; i<N; i++)
{
S[i] = 1 - S[i];
int d = tryCombination(S);
S[i] = 1 - S[i];
D[i] = d;
}
answer(S, D);
}
for(int i = 0; i<N; i++)
{
if(!visited[i])
{
S[i] = 1 - S[i];
int curr = tryCombination(S);
S[i] = 1 - S[i];
if(curr<res)
{
D[i] = curr;
visited[i] = true;
}
else if(curr>res)
{
D[i] = res;
S[i] = 1 - S[i];
visited[i] = true;
break;
}
}
}
door = res+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... |