#include <bits/stdc++.h>
#include "advisor.h"
using namespace std;
#define mp make_pair
#define fr first
#define sc second
long long ls[100069],fh[100069];
multiset<pair<long long,long long>> ms;
bitset<200069> sq;
void ComputeAdvice(int *a,int n,int d,int ub)
{
long long i;
multiset<pair<long long,long long>>::iterator it;
for(i=0;i<n;i++)
{
ls[i]=n;
}
for(i=n-1;i+1;i--)
{
fh[i]=ls[a[i]];
ls[a[i]]=i;
}
for(i=0;i<d;i++)
{
ms.insert({ls[i],i});
}
for(i=0;i<n;i++)
{
it=ms.lower_bound({i,0});
if(it==ms.end()||it->fr!=i)
{
it=prev(ms.end());
sq[it->sc]=1;
}
ms.erase(it);
ms.insert({fh[i],d+i});
}
for(i=0;i<n+d;i++)
{
WriteAdvice(sq[i]);
}
}
#include <bits/stdc++.h>
#include "assistant.h"
using namespace std;
long long nn=0,sk[100069];
bitset<100069> vtd;
void Assist(unsigned char *a,int n,int d,int m)
{
long long i,k;
for(i=0;i<d;i++)
{
vtd[i]=1;
if(a[i])
{
nn++;
sk[nn]=i;
}
}
for(i=0;i<n;i++)
{
k=GetRequest();
if(!vtd[k])
{
PutBack(sk[nn]);
vtd[sk[nn]]=0;
nn--;
}
vtd[k]=1;
if(a[d+i])
{
nn++;
sk[nn]=k;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
788 KB |
Output is correct |
2 |
Correct |
1 ms |
788 KB |
Output is correct |
3 |
Correct |
1 ms |
804 KB |
Output is correct |
4 |
Correct |
2 ms |
820 KB |
Output is correct |
5 |
Correct |
5 ms |
1100 KB |
Output is correct |
6 |
Correct |
3 ms |
1100 KB |
Output is correct |
7 |
Correct |
3 ms |
1104 KB |
Output is correct |
8 |
Correct |
3 ms |
1108 KB |
Output is correct |
9 |
Correct |
4 ms |
1096 KB |
Output is correct |
10 |
Correct |
4 ms |
1108 KB |
Output is correct |
11 |
Correct |
3 ms |
1308 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
1404 KB |
Output is correct |
2 |
Correct |
32 ms |
3964 KB |
Output is correct |
3 |
Correct |
58 ms |
8528 KB |
Output is correct |
4 |
Correct |
45 ms |
5984 KB |
Output is correct |
5 |
Correct |
43 ms |
6012 KB |
Output is correct |
6 |
Correct |
49 ms |
6280 KB |
Output is correct |
7 |
Correct |
58 ms |
7572 KB |
Output is correct |
8 |
Correct |
47 ms |
7004 KB |
Output is correct |
9 |
Correct |
40 ms |
6048 KB |
Output is correct |
10 |
Correct |
65 ms |
8196 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
47 ms |
6516 KB |
Output is correct |
2 |
Correct |
60 ms |
7784 KB |
Output is correct |
3 |
Correct |
67 ms |
7864 KB |
Output is correct |
4 |
Correct |
61 ms |
7996 KB |
Output is correct |
5 |
Correct |
59 ms |
7504 KB |
Output is correct |
6 |
Correct |
60 ms |
7948 KB |
Output is correct |
7 |
Correct |
60 ms |
8000 KB |
Output is correct |
8 |
Correct |
56 ms |
7792 KB |
Output is correct |
9 |
Correct |
53 ms |
8008 KB |
Output is correct |
10 |
Correct |
62 ms |
7888 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
1104 KB |
Output is correct |
2 |
Correct |
3 ms |
1100 KB |
Output is correct |
3 |
Correct |
3 ms |
1104 KB |
Output is correct |
4 |
Correct |
3 ms |
1496 KB |
Output is correct |
5 |
Correct |
3 ms |
1100 KB |
Output is correct |
6 |
Correct |
3 ms |
1100 KB |
Output is correct |
7 |
Correct |
3 ms |
1108 KB |
Output is correct |
8 |
Correct |
3 ms |
1108 KB |
Output is correct |
9 |
Correct |
3 ms |
1096 KB |
Output is correct |
10 |
Correct |
4 ms |
1364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
63 ms |
7392 KB |
Output is correct - 120000 bits used |
2 |
Correct |
65 ms |
7684 KB |
Output is correct - 122000 bits used |
3 |
Correct |
66 ms |
7860 KB |
Output is correct - 125000 bits used |
4 |
Correct |
62 ms |
7872 KB |
Output is correct - 125000 bits used |
5 |
Correct |
72 ms |
7860 KB |
Output is correct - 125000 bits used |
6 |
Correct |
63 ms |
7940 KB |
Output is correct - 125000 bits used |
7 |
Correct |
64 ms |
7996 KB |
Output is correct - 124828 bits used |
8 |
Correct |
63 ms |
7992 KB |
Output is correct - 124910 bits used |
9 |
Correct |
61 ms |
8092 KB |
Output is correct - 125000 bits used |
10 |
Correct |
54 ms |
7688 KB |
Output is correct - 125000 bits used |