#include "advisor.h"
void ComputeAdvice(int *C, int N, int K, int M)
{
int L[100002];
for(int i=0;i<N;i++)L[i]=-1;
for(int i=0;i<N;i++)L[C[i]]=i;
for(int i=0;i<K;i++)WriteAdvice((L[i]>=0?0:1));
for(int i=0;i<N;i++)WriteAdvice((L[C[i]]!=i?0:1));
}
#include "assistant.h"
int sz,del,G[100002],T[100002],c[100002],p,S[100002];
void Assist(unsigned char *A, int N, int K, int R)
{
for(int i=0;i<N;i++)G[i]=-1;
for(int i=0;i<K;i++)
{
S[i]=G[i]=i;
c[i]=A[i];
if(c[i])T[sz++]=i;
}
for(int i=0;i<N;i++)
{
p=GetRequest();
if(G[p]!=-1)
{
if(A[K+i])c[G[p]]=1,T[sz++]=G[p];
}
else
{
del=(sz?T[--sz]:0);
PutBack(S[del]);
G[S[del]]=-1;
S[del]=p;
c[del]=A[K+i];
G[p]=del;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
612 KB |
Output isn't correct - not an optimal way |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
12 ms |
1148 KB |
Output isn't correct - not an optimal way |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
56 ms |
3968 KB |
Output isn't correct - not an optimal way |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
4176 KB |
Output isn't correct - not an optimal way |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
74 ms |
4832 KB |
Output isn't correct - not an optimal way |
2 |
Incorrect |
76 ms |
5288 KB |
Output isn't correct - not an optimal way |
3 |
Incorrect |
88 ms |
5432 KB |
Output isn't correct - not an optimal way |
4 |
Incorrect |
69 ms |
5432 KB |
Output isn't correct - not an optimal way |
5 |
Incorrect |
69 ms |
5452 KB |
Output isn't correct - not an optimal way |
6 |
Incorrect |
98 ms |
5472 KB |
Output isn't correct - not an optimal way |
7 |
Incorrect |
70 ms |
5520 KB |
Output isn't correct - not an optimal way |
8 |
Incorrect |
67 ms |
5568 KB |
Output isn't correct - not an optimal way |
9 |
Incorrect |
67 ms |
5584 KB |
Output isn't correct - not an optimal way |
10 |
Correct |
67 ms |
5600 KB |
Output is correct - 125000 bits used |