이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "cave.h"
const int nmax=5e3+42;
int which[nmax];
int sign[nmax];
int now[nmax];
int active[nmax],sz=0;
void exploreCave(int N)
{
memset(which,-1,sizeof(which));
for(int i=0;i<N;i++)//find the i-th
{
for(int j=0;j<N;j++)
if(which[j]!=-1)now[which[j]]=sign[j];
else
{
now[j]=0;
sz++;
active[sz]=j;
}
int ans=tryCombination(now);
bool sign_now;
if(ans==-1||ans>i)sign_now=0;
else sign_now=1;
while(sz>1)
{
int mx=sz/2,pos=1;
for(int j=0;j<N;j++)
if(which[j]!=-1)now[which[j]]=sign[j];
else
{
now[j]=0;
if(pos<mx&&active[pos]==j)now[j]=sign_now,pos++;
else now[j]=!sign_now;
}
int ans=tryCombination(now);
if(ans==-1||ans>i)sz=mx;
else
{
for(int j=mx+1;j<=sz;j++)
active[j-mx]=active[j];
sz=sz-mx;
}
}
sign[active[1]]=sign_now;
which[active[1]]=i;
}
answer(sign,which);
}
# | 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... |