답안 #820042

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
820042 2023-08-10T18:23:05 Z annabeth9680 최후의 만찬 (IOI12_supper) C++17
컴파일 오류
0 ms 0 KB
#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5+20;
vector<int> t[MAXN];
int A[2*MAXN];
void ComputeAdvice(int *C, int N, int K, int M){ //C = color requests; N = length of C; K = number of colors on the scaffold
	for(int i = N-1;i >= 0;--i){
		t[C[i]].push_back(i); //the "times" color C[i] is needed, sorted in decreasing order
	}
	set<pair<int,int>> s;
	for(int i = 0;i<K;++i){
        if(t[i].empty()) s.insert({N,i});
        else s.insert({t[i].back(),i});
	} 
	for(int i = 0;i<N;++i){
        if(s.begin()->first == i) s.erase(s.begin());
        else{
            A[prev(s.end())->second] = 1;
            s.erase(prev(s.end()));
        }
        t[C[i]].pop_back();
        s.emplace(t[C[i]].empty() ? N : t[C[i]].back(),i+K);
	}
	for(int i = 0;i<K+N;++i) WriteAdvice(A[i]);
}



    

Compilation message

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