Submission #463831

# Submission time Handle Problem Language Result Execution time Memory
463831 2021-08-11T21:09:51 Z dutch Last supper (IOI12_supper) C++17
0 / 100
28 ms 2608 KB
#include <bits/stdc++.h>
using namespace std;
#include "advisor.h"

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;
#include "assistant.h"

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);
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 492 KB Error - advice must be 0 or 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 752 KB Error - advice must be 0 or 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 2336 KB Error - advice must be 0 or 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 620 KB Error - advice must be 0 or 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 2588 KB Error - advice must be 0 or 1
2 Incorrect 26 ms 2608 KB Error - advice must be 0 or 1
3 Incorrect 26 ms 2580 KB Error - advice must be 0 or 1
4 Incorrect 26 ms 2528 KB Error - advice must be 0 or 1
5 Incorrect 26 ms 2524 KB Error - advice must be 0 or 1
6 Incorrect 28 ms 2528 KB Error - advice must be 0 or 1
7 Incorrect 27 ms 2580 KB Error - advice must be 0 or 1
8 Incorrect 26 ms 2532 KB Error - advice must be 0 or 1
9 Incorrect 26 ms 2524 KB Error - advice must be 0 or 1
10 Incorrect 25 ms 2516 KB Error - advice must be 0 or 1