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 "advisor.h"
int late[100002],color[100002];
void ComputeAdvice(int *C, int N, int K, int M)
{
for(int i=0;i<N;i++)color[i]=C[i],late[i]=-1;
for(int i=0;i<N;i++)
{
late[color[i]]=i;
}
for(int i=0;i<K;i++)
{
if(late[i]==-1)WriteAdvice(1);
else WriteAdvice(0);
}
for(int i=0;i<N;i++)
{
if(late[color[i]]==i)
{
WriteAdvice(1);
}
else WriteAdvice(0);
}
}
#include "assistant.h"
int check,o,go[100002],T[100002],ch[100002],p,st[100002],sz,t;
void Assist(unsigned char *A, int N, int K, int R)
{
for(int i=0;i<N;i++)go[i]=-1;
for(int i=0;i<K;i++)
{
st[i]=i;
go[i]=i;
if(A[i]==0)
{
ch[i]=0;
}
else
{
ch[i]=1;
T[sz++]=i;
}
}
for(int i=0;i<N;i++)
{
p=GetRequest();
check=A[K+i];
if(go[p]!=-1)
{
if(check)ch[go[p]]=1,T[sz++]=go[p];
}
else
{
if(sz)
{
sz--;
PutBack(st[T[sz]]);
go[st[T[sz]]]=-1;
st[T[sz]]=p;
ch[T[sz]]=check;
go[p]=T[sz];
}
else
{
PutBack(st[0]);
go[st[0]]=-1;
st[0]=p;
ch[0]=check;
go[p]=0;
}
}
}
}
# | 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... |