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;
int n;
bool vis[5005];
bool sta[5005];
int probaj(int l, int r, bool inv)
{
int c[n];
for (int i=0;i<l;i++) c[i]=inv;
for (int i=l;i<=r;i++) c[i]=!inv;
for (int i=r+1;i<n;i++) c[i]=inv;
for (int i=0;i<n;i++) if (vis[i]) c[i]=sta[i];
return tryCombination(c);
}
void exploreCave(int N)
{
n=N;
int s[n],d[n];
for (int i=0;i<n;i++)
{
bool inv=0;
int l=0,r=n-1;
if (probaj(l,r,inv)==i) inv=1;
while (l!=r)
{
int mid=(l+r)/2;
if (probaj(l,mid,inv)==i) l=mid+1;
else r=mid;
}
vis[l]=1;
sta[l]=!inv;
d[l]=i,s[l]=sta[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... |