# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1151057 | KhoaDuy | Last supper (IOI12_supper) | C++20 | 49 ms | 4424 KiB |
#include "advisor.h"
#include<bits/stdc++.h>
using namespace std;
void ComputeAdvice(int *C,int n,int k,int m){
int c[n+k];
for(int i=0;i<n;i++){
c[k+i]=C[i];
}
for(int i=0;i<k;i++){
c[i]=i;
}
int state[n+k]={0};
int last[n];
for(int i=0;i<n;i++){
last[i]=n+k;
}
int nxt[n+k];
for(int i=n+k-1;i>=0;i--){
nxt[i]=last[c[i]];
last[c[i]]=i;
}
set<pair<int,int>> se;
for(int i=0;i<k;i++){
se.insert({nxt[i],i});
}
for(int i=k;i<n+k;i++){
set<pair<int,int>>::iterator it=se.begin();
if((*it).first==i){
se.erase(it);
}
# | 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... |