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 <vector>
using namespace std;
vector <int> A;
int S[5000], D[5000], Check[5000];
void exploreCave(int N)
{
int i, j, Left, Mid, Right, Value, Temp;
for(i=0 ; i<N ; i++)
{
A.clear();
for(j=0 ; j<N ; j++)
if(!Check[j])
A.push_back(j);
Left=0;
Right=A.size()-1;
Value=tryCombination(S);
while(Left<Right)
{
Mid=(Left+Right)/2;
for(j=Left ; j<=Mid ; j++)
S[A[j]]=1-S[A[j]];
Temp=tryCombination(S);
for(j=Left ; j<=Mid ; j++)
S[A[j]]=1-S[A[j]];
if(Value==i)
{
if(Temp>i || Temp==-1)
Right=Mid;
else
Left=Mid+1;
}
else
{
if(Temp==i)
Right=Mid;
else
Left=Mid+1;
}
}
if(Value==i)
S[A[Left]]=1-S[A[Left]];
D[A[Left]]=i;
Check[A[Left]]=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... |