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;
typedef long long ll;
const int maxn = 5010;
int s[maxn],d[maxn],f[maxn];
void exploreCave(int n){
for(int i=0;i<n;i++)f[i] = -1;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++)if(f[j] == -1)s[j] = 0;
int to = tryCombination(s);
bool ri = 0;
if(to == i)ri = 1;
for(int j=0;j<n;j++)if(f[j] == -1)s[j] = !ri;
int md,lo=0,hi=n-1,at=-1;
while(lo <= hi){
md = (lo+hi)/2;
for(int j=lo;j<=md;j++)if(f[j] == -1)s[j] = ri;
to = tryCombination(s);
for(int j=lo;j<=md;j++)if(f[j] == -1)s[j] = !ri;
if(to == i){
lo = md+1;
}else{
hi = md-1;
at = md;
}
}
f[at] = 0;
d[at] = i;
s[at] = ri;
}
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... |