| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 31157 | Lobelia | 최후의 만찬 (IOI12_supper) | C++11 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "advisor.h"
#include<bits/stdc++.h>
using namespace std;
int b[100141],i,j,*ans;
priority_queue<pair<int,int>>pq;
deque<int>t[100141];
void ComputeAdvice(int *c, int n, int k, int m){
ans=(int*) malloc(n*sizeof(int));
for(i=0;i<n;i++)
t[c[i]].push_back(i);
for(i=0;i<n;i++)
t[i].push_back(999999);
for(i=0;i<k;i++)
{
b[i]=1;
pq.push({t[i][0],i});
}
for(i=0;i<n;i++)
{
t[c[i]].pop_front();
if(b[c[i]])
ans[i]=-1;
else
{
while(b[pq.top().second]==0)
pq.pop();
ans[i]=pq.top().second;
b[pq.top().second]=0;
b[c[i]]=1;
pq.pop();
}
pq.push({t[c[i]][0],c[i]});
}
}
#include "assistant.h"
extern int *ans;
void Assist(unsigned char *A, int n, int K, int R) {
for(int i=0;i<n;i++)
{
GetRequest();
if(ans[i]!=-1)
PutBack(ans[i]);
}
}
