제출 #122191

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
1221912019-06-27 19:43:55Osama_Alkhodairy최후의 만찬 (IOI12_supper)C++17
43 / 100
2598 ms8244 KiB
#include <bits/stdc++.h>
#include "advisor.h"
//~ #include "grader.cpp"
using namespace std;
void ComputeAdvice(int *C, int N, int K, int M) {
vector <int> las(N, N);
vector <int> nex(N);
for(int i = N - 1 ; i >= 0 ; i--){
nex[i] = las[C[i]];
las[C[i]] = i;
}
set <pair <int, int> > ready;
for(int i = 0 ; i < K ; i++){
ready.insert(make_pair(las[i], i));
}
vector <int> p(N);
for(int i = 0 ; i < N ; i++){
if(ready.count(make_pair(i, C[i]))){
ready.erase(ready.find(make_pair(i, C[i])));
ready.insert(make_pair(nex[i], C[i]));
continue;
}
ready.erase(--ready.end());
ready.insert(make_pair(nex[i], C[i]));
p[i] = 1;
}
int optimal = 0;
for(auto &i : p) optimal += i;
for(int i = 0 ; i < K ; i++){
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...