Submission #463830

# Submission time Handle Problem Language Result Execution time Memory
463830 2021-08-11T21:08:56 Z dutch Last supper (IOI12_supper) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

void ComputeAdvice(int *C, int N, int K, int M){
	int next[N], last[N];
	fill(last, last+N, N);
	bool on[N], r[N+K] = {};

	for(int i=N; --i>=0; ){
		next[i] = last[C[i]];
		last[C[i]] = i;
		on[i] = i < K;
	}
	priority_queue<array<int, 2>> q;

	for(int i=0; i<N; ++i){
		if(i < K) q.push({last[i], i});
		last[i] = i < K ? i : -1;
	}

	for(int i=0; i<N; ++i){
		if(!on[C[i]]){
			while(!on[q.top()[1]]) q.pop();
			int j = q.top()[1]; q.pop();
			r[K+last[j]] = !(on[j] = 0);
		}
		q.push({next[C[i]], C[i]});
		on[C[i]] = 1;
		last[C[i]] = K + i;
	}

	for(int i=0; i<N+K; ++i) WriteAdvice('0'+r[i]);
}
#include <bits/stdc++.h>
using namespace std;

void Assist(unsigned char *A, int N, int K, int R){
	vector<int> s;
	bool on[N] = {};
	for(int i=0; i<K; ++i){
		on[i] = 1;
		if(A[i]) s.push_back(i);
	}

	for(int i=0; i<N; ++i){
		int j = GetRequest();
		if(!on[j]){
			PutBack(s.back());
			s.pop_back();
			on[j] = 1;
		}
		if(A[K+i]) s.push_back(j);
	}
}

Compilation message

advisor.cpp: In function 'void ComputeAdvice(int*, int, int, int)':
advisor.cpp:32:27: error: 'WriteAdvice' was not declared in this scope; did you mean 'ComputeAdvice'?
   32 |  for(int i=0; i<N+K; ++i) WriteAdvice('0'+r[i]);
      |                           ^~~~~~~~~~~
      |                           ComputeAdvice

assistant.cpp: In function 'void Assist(unsigned char*, int, int, int)':
assistant.cpp:13:11: error: 'GetRequest' was not declared in this scope
   13 |   int j = GetRequest();
      |           ^~~~~~~~~~
assistant.cpp:15:4: error: 'PutBack' was not declared in this scope
   15 |    PutBack(s.back());
      |    ^~~~~~~