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>
#include <stdio.h>
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(i=Left ; i<=Mid ; i++)
S[A[i]]=1-S[A[i]];
Temp=tryCombination(S);
for(i=Left ; i<=Mid ; i++)
S[A[i]]=1-S[A[i]];
if(Value==i)
{
if(Temp>i || Temp==-1)
Right=Mid-1;
else
Left=Mid+1;
}
else
{
if(Temp==i)
Right=Mid-1;
else
Left=Mid+1;
}
}
if(Value==i)
S[A[Left]]=1-S[A[Left]];
D[A[Left]]=i;
}
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... |