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 <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;
}
}
}
# | 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... |