# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31143 | cscandkswon | Last supper (IOI12_supper) | C++14 | 333 ms | 145544 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 "advisor.h"
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
const int MAXN=100005;
deque<int> D[MAXN];
multimap<int, int> S;
unordered_set<int> U;
int A[MAXN];
void ComputeAdvice(int *C, int N, int K, int M) {
int i;
for(i=0; i<N; i++) D[C[i]].push_back(i);
for(i=0; i<N; i++) D[i].push_back(N);
for(i=0; i<K; i++) S.insert(make_pair(D[i].front(), i));
for(i=0; i<K; i++) U.insert(i);
for(i=0; i<N; i++){
if(U.find(C[i])!=U.end()){
A[i]=-1;
S.erase(S.begin());
D[C[i]].pop_front();
S.insert(make_pair(D[C[i]].front(), C[i]));
}
else{
pair<int, int> p=*(--S.end());
S.erase(--S.end());
A[i]=p.second;
D[C[i]].pop_front();
S.insert(make_pair(D[C[i]].front(), C[i]));
# | 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... |