답안 #114326

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
114326 2019-05-31T22:25:34 Z nxteru 최후의 만찬 (IOI12_supper) C++14
컴파일 오류
0 ms 0 KB
#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;
int n,k,nex[200005],p[200005],ex[200005],ans[200005];
void ComputeAdvice(int *C, int N, int K, int M) {
	n=N,k=K;
	for(int i=0;i<n;i++)p[i]=n,ex[i]=-1;
	for(int i=n-1;i>=0;i--){
		nex[i]=p[C[i]];
		p[C[i]]=i;
	}
	priority_queue<P>d;
	for(int i=0;i<k;i++)d.push(P(p[i],i)),ex[i]=i;
	for(int i=0;i<n;i++){
		int c=C[i];
		if(ex[c]!=-1)ans[ex[c]]=1;
		else{
			int y;
			while(1){
				y=d.top().S;
				d.pop();
				if(ex[y]==-1)continue;
			}
			ex[y]=-1;
		}
		ex[c]=k+i;
		d.push(P(nex[i],c));
	}
	for(int i=0;i<k+n;i++)WriteAidvise(ans[i]);
}
#include "assistant.h"
#include <bits/stdc++.h>
using namespace std;
int s,q,l;
set<int>x,y;
void Assist(unsigned char *A, int N, int K, int R) {
	s=N,q=K;
	for(int i=0;i<k;i++){
		if(A[i]==0)x.insert(i);
		else y.insert(i);
	}
	for(int i=k;i<k+n;i++){
		int c=GetRequest();
		if(y.find(c)!=y.end())y.erase(c);
		else{
			PutBack(*x.begin());
			x.erase(x.begin());
		}
		if(A[i]==0)x.insert(c);
		else y.insert(c);
	}
}

Compilation message

advisor.cpp: In function 'void ComputeAdvice(int*, int, int, int)':
advisor.cpp:12:17: error: 'P' was not declared in this scope
  priority_queue<P>d;
                 ^
advisor.cpp:12:18: error: template argument 1 is invalid
  priority_queue<P>d;
                  ^
advisor.cpp:12:18: error: template argument 2 is invalid
advisor.cpp:12:18: error: template argument 3 is invalid
advisor.cpp:13:24: error: request for member 'push' in 'd', which is of non-class type 'int'
  for(int i=0;i<k;i++)d.push(P(p[i],i)),ex[i]=i;
                        ^~~~
advisor.cpp:20:9: error: request for member 'top' in 'd', which is of non-class type 'int'
     y=d.top().S;
         ^~~
advisor.cpp:21:7: error: request for member 'pop' in 'd', which is of non-class type 'int'
     d.pop();
       ^~~
advisor.cpp:27:5: error: request for member 'push' in 'd', which is of non-class type 'int'
   d.push(P(nex[i],c));
     ^~~~
advisor.cpp:29:24: error: 'WriteAidvise' was not declared in this scope
  for(int i=0;i<k+n;i++)WriteAidvise(ans[i]);
                        ^~~~~~~~~~~~
advisor.cpp:29:24: note: suggested alternative: 'WriteAdvice'
  for(int i=0;i<k+n;i++)WriteAidvise(ans[i]);
                        ^~~~~~~~~~~~
                        WriteAdvice

assistant.cpp: In function 'void Assist(unsigned char*, int, int, int)':
assistant.cpp:8:16: error: 'k' was not declared in this scope
  for(int i=0;i<k;i++){
                ^
assistant.cpp:12:12: error: 'k' was not declared in this scope
  for(int i=k;i<k+n;i++){
            ^
assistant.cpp:12:18: error: 'n' was not declared in this scope
  for(int i=k;i<k+n;i++){
                  ^