# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1023024 | vjudge1 | Last supper (IOI12_supper) | C++17 | 0 ms | 0 KiB |
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 "assistant.h"
#include<bits/stdc++.h>
using namespace std;
bitset<500100>on;
void Assist(unsigned char *A, int N, int K, int R) {
set<int>passive;
for(int i=0;i<K;on[i]=1,i++)
if(A[N+i])
passive.insert(i);
for(int i=0;i<N;i++){
int x=GetRequest();
if(on[x]) { if(A[i])
passive.insert(x);
continue;
}
int die=*passive.begin();
PutBack(die);
on[die]=0;on[x]=1;
passive.erase(die);
if(A[i])passive.insert(x);
}
}