답안 #122163

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
122163 2019-06-27T18:17:02 Z TadijaSebez 최후의 만찬 (IOI12_supper) C++11
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#include "advisor.h"
#define pb push_back
const int N=100050;
int last[N],go[N];
bool in[N];
pair<int,pair<int,int>> l[N];
int was[2*N];
void ComputeAdvice(int *C, int n, int k, int M)
{
	priority_queue<pair<int,pair<int,int>>> pq,rq;
	for(int i=0;i<n;i++) last[i]=n;
	for(int i=n-1;i>=0;i--) go[i]=last[C[i]],last[C[i]]=i;
	for(int i=0;i<k;i++)
	{
		pq.push({last[i],{i,i}});
		in[i]=1;
		l[i]={last[i],{i,i}};
	}
	for(int i=0;i<n;i++)
	{
		while(pq.size() && rq.size() && pq.top()==rq.top()) pq.pop(),rq.pop();
		if(in[C[i]])
		{
			rq.push(l[C[i]]);
			l[C[i]]={go[i],{C[i],i+k}};
			pq.push(l[C[i]]);
		}
		else
		{
			was[pq.top().second.second]=1;
			in[pq.top().second.first]=0;
			rq.push(pq.top());
			l[C[i]]={go[i],{C[i],i+k}};
			pq.push(l[C[i]]);
			in[C[i]]=1;
		}
	}
	for(int i=0;i<n+k;i++) WriteAdvice(was[i]);
}
#include <bits/stdc++.h>
using namespace std;
#include "advisor.h"
#define pb push_back
const int N=100050;
int last[N],go[N];
bool in[N];
pair<int,pair<int,int>> l[N];
int was[2*N];
void ComputeAdvice(int *C, int n, int k, int M)
{
	priority_queue<pair<int,pair<int,int>>> pq,rq;
	for(int i=0;i<n;i++) last[i]=n;
	for(int i=n-1;i>=0;i--) go[i]=last[C[i]],last[C[i]]=i;
	for(int i=0;i<k;i++)
	{
		pq.push({last[i],{i,i}});
		in[i]=1;
		l[i]={last[i],{i,i}};
	}
	for(int i=0;i<n;i++)
	{
		while(pq.size() && rq.size() && pq.top()==rq.top()) pq.pop(),rq.pop();
		if(in[C[i]])
		{
			rq.push(l[C[i]]);
			l[C[i]]={go[i],{C[i],i+k}};
			pq.push(l[C[i]]);
		}
		else
		{
			was[pq.top().second.second]=1;
			in[pq.top().second.first]=0;
			rq.push(pq.top());
			l[C[i]]={go[i],{C[i],i+k}};
			pq.push(l[C[i]]);
			in[C[i]]=1;
		}
	}
	for(int i=0;i<n+k;i++) WriteAdvice(was[i]);
}

Compilation message

/tmp/ccwl6a2P.o: In function `main':
assistant_grader.cpp:(.text.startup+0x1ed): undefined reference to `Assist(unsigned char*, int, int, int)'
/tmp/ccZymIB5.o: In function `ComputeAdvice(int*, int, int, int)':
assistant.cpp:(.text+0x6b1): undefined reference to `WriteAdvice(unsigned char)'
collect2: error: ld returned 1 exit status