# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
280530 | ElyesChaabouni | Last supper (IOI12_supper) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "assistant.h"
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#define ordered_set tree<int, null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update>
#define eps 1e-9
#define MOD1 998244353
#define MOD2 1000000007
#define INV_10 299473306
#define INF 1000000000
#define PI 3.14159265358979323846
using namespace std;
void Assist(unsigned char *A, int N, int K, int R) {
int cu=N, nb=0;
while(cu)
{
nb++;
cu/=2;
}
vector<int>v[N];
int step=0;
for(int i = 0; i < R; i++)
{
int x=0;
for(int j = 0; j < nb; j++)
{
if(A[i+j]=='1')
x+=(1<<j);
}
v[x].push_back(step);
step++;
i+=nb;
i--;
}
for(int i = 0; i < N; i++)
v[i].push_back(1000000000);
set<int>s;
for(int i = 0; i < K; i++)
s.insert(i);
priority_queue<pair<int, int> >pq;
for(int i = 0; i < K; i++)
pq.push(make_pair(v[i][0], i));
for(int i = 0; i < N; i++)
{
int next_color=GetRequest();
if(!s.count(next_color))
{
while(!s.count(pq.top().second))
{
pq.pop();
}
PutBack(pq.top().second);
s.erase(pq.top().second);
s.insert(next_color);
}
vector<int>::iterator it=upper_bound(v[next_color].begin(), v[next_color].end(), i);
pq.push(make_pair((*it), next_color));
}
}
//size