답안 #463829

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
463829 2021-08-11T21:00:10 Z dutch 최후의 만찬 (IOI12_supper) C++17
0 / 100
81 ms 6616 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[C[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(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);
	}
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 616 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 8 ms 1252 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 61 ms 5340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 1016 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 72 ms 6416 KB Execution killed with signal 11
2 Runtime error 73 ms 6616 KB Execution killed with signal 11
3 Runtime error 80 ms 6584 KB Execution killed with signal 11
4 Incorrect 78 ms 6024 KB Error - Putting back a color that is not on the scaffold
5 Runtime error 81 ms 6528 KB Execution killed with signal 11
6 Runtime error 72 ms 6552 KB Execution killed with signal 11
7 Runtime error 73 ms 6556 KB Execution killed with signal 11
8 Runtime error 77 ms 6540 KB Execution killed with signal 11
9 Incorrect 74 ms 5828 KB Error - Putting back a color that is not on the scaffold
10 Runtime error 73 ms 6448 KB Execution killed with signal 11