#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]+1?0:1));
for(int i=0;i<N;i++)WriteAdvice((L[C[i]]-i?0:1));
}
#include "assistant.h"
int sz,del,p,on,T[100002],c[100002];
void Assist(unsigned char *A, int N, int K, int R)
{
for(int i=0;i<K;i++)
{
c[i]=1;on=i;
if(A[i])T[sz++]=i;
}
for(int i=0;i<N;i++)
{
p=GetRequest();
if(!c[p])
{
del=sz?T[--sz]:on;
PutBack(del);
c[del]=0;c[p]=1;
}
if(A[K+i])T[sz++]=p;
on=p;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
864 KB |
Output is correct |
2 |
Correct |
4 ms |
976 KB |
Output is correct |
3 |
Correct |
4 ms |
1016 KB |
Output is correct |
4 |
Incorrect |
5 ms |
1052 KB |
Output isn't correct - not an optimal way |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
10 ms |
1304 KB |
Output isn't correct - not an optimal way |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
71 ms |
4000 KB |
Output is correct |
2 |
Correct |
89 ms |
4832 KB |
Output is correct |
3 |
Correct |
94 ms |
5124 KB |
Output is correct |
4 |
Correct |
68 ms |
5152 KB |
Output is correct |
5 |
Incorrect |
73 ms |
5152 KB |
Output isn't correct - not an optimal way |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
5152 KB |
Output is correct |
2 |
Correct |
7 ms |
5152 KB |
Output is correct |
3 |
Correct |
6 ms |
5152 KB |
Output is correct |
4 |
Incorrect |
9 ms |
5152 KB |
Output isn't correct - not an optimal way |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
67 ms |
5152 KB |
Output isn't correct - not an optimal way |
2 |
Correct |
82 ms |
5152 KB |
Output is correct - 122000 bits used |
3 |
Correct |
79 ms |
5152 KB |
Output is correct - 125000 bits used |
4 |
Correct |
76 ms |
5152 KB |
Output is correct - 125000 bits used |
5 |
Correct |
74 ms |
5152 KB |
Output is correct - 125000 bits used |
6 |
Correct |
88 ms |
5152 KB |
Output is correct - 125000 bits used |
7 |
Correct |
100 ms |
5200 KB |
Output is correct - 124828 bits used |
8 |
Correct |
72 ms |
5248 KB |
Output is correct - 124910 bits used |
9 |
Correct |
107 ms |
5248 KB |
Output is correct - 125000 bits used |
10 |
Correct |
85 ms |
5260 KB |
Output is correct - 125000 bits used |