# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
986355 | Pyqe | Cave (IOI13_cave) | C++17 | 558 ms | 600 KiB |
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;
long long n;
int a[5069],sq[5069];
bitset<5069> spc;
long long qr(long long ky,long long x)
{
long long i;
for(i=0;i<n;i++)
{
if(sq[i]<n)
{
a[i]=spc[sq[i]];
}
else
{
a[i]=ky^i<=x;
}
}
return tryCombination(a);
}
void exploreCave(int on)
{
long long i,lh,rh,md,zz;
n=on;
for(i=0;i<n;i++)
{
sq[i]=n;
}
for(i=0;i<n;i++)
{
spc[i]=qr(1,n-1)==i;
for(lh=0,rh=n-1;lh<=rh;)
{
md=(lh+rh)/2;
if(qr(spc[i],md)==i)
{
zz=md;
rh=md-1;
}
else
{
lh=md+1;
}
}
sq[zz]=i;
}
for(i=0;i<n;i++)
{
a[i]=spc[sq[i]];
}
answer(a,sq);
}
Compilation message (stderr)
# | 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... |