Submission #986351

#TimeUsernameProblemLanguageResultExecution timeMemory
986351PyqeLast supper (IOI12_supper)C++17
100 / 100
72 ms8528 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...