답안 #251702

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
251702 2020-07-22T08:10:49 Z tinjyu 최후의 만찬 (IOI12_supper) C++14
컴파일 오류
0 ms 0 KB
#include <iostream>
#include <algorithm>
#include "advisor.h"
using namespace std;
long long int maxlen,ans[1000005],k,map[1000005],in[1000005],t[1000005],p[1000005];
struct node{
	long long int road,id;
}now[1000005];
struct cmp{
	bool operator()(const node &a,const node &b)
	{
		return a.road<b.road;
	}
};
void find(int x)
{
	for(int i=1;i<=maxlen;i++)
	{
		if(x%2==0)WriteAdvice(0);
		else WriteAdvice(1);
		//cout<<x%2<<" ";
		x/=2;
	}
	return ;
}
void ComputeAdvice(int *C, int N, int K, int M) {
	k=K;
	long long int x=1;
	while(x<k)
	{
		x*=2;
		maxlen++;
	}
	for(int i=0;i<N;i++)now[i].road=99999999999999999;
	for(int i=0;i<N;i++)
	{
		map[i]=now[C[i]].road;
		now[C[i]].road=i;
	}
	for(int i=0;i<N;i++)p[i]=-1;
	for(int i=0;i<K;i++)
	{
		t[i]=i;
		now[i].id=i;
		p[i]=i;
		push_heap(now,now+i+1,cmp());
	}
	//for(int i=0;i<K;i++)cout<<now[i].id<<" ";
	//cout<<endl;
	for(int i=0;i<N;i++)
	{
		if(p[C[i]]!=-1)continue;
		else
		{
			pop_heap(now,now+K,cmp());
			p[C[i]]=p[now[K-1].id];
			find(p[C[i]]);
			p[now[K-1].id]=-1;
			now[C[i]].road=map[now[C[i]].road];
			now[K-1].id=C[i];
			push_heap(now,now+K,cmp());
		}
	}
}



    

Compilation message

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