답안 #116755

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
116755 2019-06-13T17:22:49 Z faustaadp 최후의 만찬 (IOI12_supper) C++17
컴파일 오류
0 ms 0 KB
#include "assistant.h"
#include<bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll z[2010101],isi[101010];
ll y[101010];
ll ada[101010];
ll las[101010];
ll lok[101010];
void Assist(unsigned char *A, int N, int K, int R) 
{
	priority_queue<pair<ll,ll> > pq;
	ll i,j;
	ll x=ceil(log(N)/log(2));
  	for (i = 0; i < R; i++)
  	{
  		if(A[i])
  		{
  	//		cout<<i<<"YA\n";
  			z[i]=1;
  		}
  		//cout<<i<<"___"<<A[i]<<"\n";
  		//z[(ll)A[i]]=1; 
  	}
  	for (i = 0; i < N; i++) 
  		for(j=0;j<x;j++)
  			isi[i]+=z[i*x+j]*(1<<j);
  	for(i=0;i<N;i++)
  	{
  	//	cout<<i<<" "<<isi[i]<<"\n";
  		las[i]=N;
  	}
  	for(i=N-1;i>=0;i--)
  	{
  		y[i]=las[isi[i]];
  		las[isi[i]]=i;
  	}
  	for(i=0;i<K;i++)
  	{
  		pq.push(mp(las[i],i));
  		ada[i]=1;
  		lok[i]=i;
  	}
  	for (i = 0; i < N; i++) 
  	{
	    int req = GetRequest();
  		if(ada[req])
  		{
  			las[isi[i]]=y[i];
	  		pq.push(mp(las[isi[i]],isi[i]));
  		}
  		else
  		{
	  		while(!pq.empty()&&ada[pq.top().se]==0)pq.pop();
	  		while(!pq.empty()&&las[pq.top().se]!=pq.top().fi)pq.pop();
	  		ada[req]=1;
	  		ll tem=pq.top().se;
	  		ll za=lok[tem];
	  		lok[za]=req;
	  	//	cout<<i<<" "<<tem<<"_)	\n";
	  		pq.pop();
	  		ada[tem]=0;
	  		las[isi[i]]=y[i];
	  		pq.push(mp(las[isi[i]],isi[i]));
	  		//pq.push(mp(las[req],req));
	  		PutBack(tem);
  		}
  	}
 
}
#include "advisor.h"
#include<bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll a[101010];
void ComputeAdvice(int *C, int N, int K, int M) 
{
	ll i,j;
	ll x=ceil(log(N)/log(2));
	for(i=0;i<N;i++)
		a[i]=C[i];
	for(i=0;i<N;i++)
	{
		for(j=0;j<x;j++)
			if(a[i]&(1<<j))
			{
			//	cout<<"_1\n";
				WriteAdvice(1);
			}
			else
			{
			//	cout<<"_0\n";
				WriteAdvice(0);
			}
	}
}

Compilation message

/tmp/ccaAjz5c.o: In function `main':
advisor_grader.cpp:(.text.startup+0xbd): undefined reference to `ComputeAdvice(int*, int, int, int)'
/tmp/ccihVehX.o: In function `Assist(unsigned char*, int, int, int)':
advisor.cpp:(.text+0x275): undefined reference to `GetRequest()'
advisor.cpp:(.text+0x42e): undefined reference to `PutBack(int)'
collect2: error: ld returned 1 exit status

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