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 s[5005];
int state[5005];
int now[5005];
int last[5005];
int mp[5005];
void exploreCave(int N) {
for(int i=0;i<N;i++)
{
int l = 0;
int r = N-1;
int xx = tryCombination(s);
if(xx != i) now[i] = true;
else now[i] = false;
// cout<<"pre"<<" "<<now[i]<<endl;
// cout<<"i"<<i<<endl;
while(l<=r)
{
// cout<<"l r"<<l<<" "<<r<<endl;
if(l == r)
{
int xx = tryCombination(s);
if(xx == i)
{
s[l] ^=1;
}
break;
}
int mid = (l+r)>>1;
for(int j=l;j<=mid;j++)
{
if(state[j] == false)s[j] ^= 1;
}
int xx = tryCombination(s);
// cout<<"xx"<<xx<<endl;
bool flag = false;
if(xx != i)flag = true;
// cout<<"flag"<<flag<<endl;
if(now[i] == flag)
{
// cout<<"yeah"<<endl;
l = mid+1;
}
else
{
r = mid;
}
now[i] = flag;
}
// cout<<l<<endl;
state[l] = true;
mp[l] = i;
/* for(int j=0;j<N;j++)
{
cout<<s[j]<<" ";
}
cout<<endl;*/
}
answer(s,mp);
return;
}
# | 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... |