답안 #514842

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
514842 2022-01-18T14:46:22 Z andrei_boaca 최후의 만찬 (IOI12_supper) C++14
61 / 100
94 ms 4952 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[last[j]] = !(on[j] = 0);
		}
		q.push({next[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());
			on[s.back()] = 0;
			s.pop_back();
			on[j] = 1;
		}
		if(!!A[K+i]) s.push_back(j);
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 484 KB Output is correct
2 Correct 0 ms 492 KB Output is correct
3 Correct 1 ms 624 KB Output is correct
4 Correct 2 ms 636 KB Output is correct
5 Correct 3 ms 652 KB Output is correct
6 Correct 4 ms 656 KB Output is correct
7 Correct 3 ms 784 KB Output is correct
8 Correct 3 ms 644 KB Output is correct
9 Correct 6 ms 644 KB Output is correct
10 Correct 3 ms 776 KB Output is correct
11 Correct 3 ms 784 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1076 KB Output is correct
2 Correct 27 ms 2540 KB Output is correct
3 Correct 59 ms 4660 KB Output is correct
4 Correct 60 ms 4400 KB Output is correct
5 Correct 51 ms 4388 KB Output is correct
6 Correct 54 ms 4436 KB Output is correct
7 Correct 57 ms 4584 KB Output is correct
8 Correct 50 ms 3972 KB Output is correct
9 Correct 49 ms 4288 KB Output is correct
10 Correct 68 ms 4676 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 3852 KB Output is correct
2 Correct 59 ms 4688 KB Output is correct
3 Correct 62 ms 4632 KB Output is correct
4 Correct 66 ms 4704 KB Output is correct
5 Correct 52 ms 4768 KB Output is correct
6 Correct 69 ms 4732 KB Output is correct
7 Correct 59 ms 4788 KB Output is correct
8 Correct 59 ms 4532 KB Output is correct
9 Correct 56 ms 4952 KB Output is correct
10 Correct 60 ms 4624 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 640 KB Output is correct
2 Correct 4 ms 648 KB Output is correct
3 Correct 3 ms 644 KB Output is correct
4 Correct 4 ms 644 KB Output is correct
5 Correct 5 ms 720 KB Output is correct
6 Correct 4 ms 644 KB Output is correct
7 Correct 3 ms 656 KB Output is correct
8 Correct 4 ms 772 KB Output is correct
9 Correct 3 ms 776 KB Output is correct
10 Correct 4 ms 780 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 67 ms 4608 KB Output is correct - 120000 bits used
2 Correct 80 ms 4720 KB Output is correct - 122000 bits used
3 Correct 57 ms 4732 KB Output is correct - 125000 bits used
4 Correct 60 ms 4664 KB Output is correct - 125000 bits used
5 Correct 62 ms 4576 KB Output is correct - 125000 bits used
6 Correct 61 ms 4692 KB Output is correct - 125000 bits used
7 Correct 83 ms 4556 KB Output is correct - 124828 bits used
8 Correct 66 ms 4568 KB Output is correct - 124910 bits used
9 Correct 69 ms 4688 KB Output is correct - 125000 bits used
10 Correct 94 ms 4492 KB Output is correct - 125000 bits used