답안 #73973

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
73973 2018-08-29T12:54:09 Z sebinkim 최후의 만찬 (IOI12_supper) C++14
100 / 100
140 ms 8392 KB
#include "advisor.h"

#include <bits/stdc++.h>

using namespace std;

typedef pair <int, int> pii;

static int P[151515], K[151515];
static priority_queue <pii> Q;
static bool chk[151515], ans[151515];

void ComputeAdvice(int *C, int n, int k, int m)
{
	int i, t, x;
	
	for(i=0; i<n; i++) P[i] = n + k + 1;
	
	for(i=n-1; i>=0; i--){
		K[k + i] = P[C[i]];
		P[C[i]] = k + i;
	}
	
	for(i=0; i<k; i++){
		K[i] = P[i];
		P[i] = i; chk[i] = 1;
		Q.push(pii(K[i], i));
	}
	
	for(i=0; i<n; i++){
		if(!chk[C[i]]){
			for(; ;){
				t = Q.top().second; Q.pop();
				x = t >= k? C[t - k] : t;
				if(chk[x]){
					chk[x] = 0; ans[t] = 1;
					break;
				}
			}
			chk[C[i]] = 1;
		}
		Q.push(pii(K[k + i], k + i));
	}
	
	for(i=0; i<n+k; i++){
		WriteAdvice(ans[i]);
	}
}
#include "assistant.h"

#include <bits/stdc++.h>

using namespace std;

static vector <int> V;
static bool chk[101010];

void Assist(unsigned char *A, int n, int k, int r)
{
	int i, c;
	
	for(i=0; i<k; i++){
		if(A[i]) V.push_back(i);
		chk[i] = 1;
	}
	
	for(i=0; i<n; i++){
		c = GetRequest();
		if(!chk[c]){
			chk[V.back()] = 0;
			PutBack(V.back());
			V.pop_back();
		}
		if(A[k + i]) V.push_back(c);
		chk[c] = 1;
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 840 KB Output is correct
2 Correct 6 ms 1024 KB Output is correct
3 Correct 6 ms 1228 KB Output is correct
4 Correct 7 ms 1312 KB Output is correct
5 Correct 10 ms 1568 KB Output is correct
6 Correct 10 ms 1608 KB Output is correct
7 Correct 10 ms 1608 KB Output is correct
8 Correct 10 ms 1608 KB Output is correct
9 Correct 9 ms 1728 KB Output is correct
10 Correct 12 ms 1728 KB Output is correct
11 Correct 11 ms 1728 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 1984 KB Output is correct
2 Correct 50 ms 4896 KB Output is correct
3 Correct 140 ms 7864 KB Output is correct
4 Correct 92 ms 7864 KB Output is correct
5 Correct 91 ms 7864 KB Output is correct
6 Correct 90 ms 7864 KB Output is correct
7 Correct 98 ms 7864 KB Output is correct
8 Correct 115 ms 7864 KB Output is correct
9 Correct 75 ms 7864 KB Output is correct
10 Correct 122 ms 8024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 93 ms 8024 KB Output is correct
2 Correct 107 ms 8024 KB Output is correct
3 Correct 128 ms 8024 KB Output is correct
4 Correct 103 ms 8024 KB Output is correct
5 Correct 115 ms 8024 KB Output is correct
6 Correct 93 ms 8024 KB Output is correct
7 Correct 123 ms 8024 KB Output is correct
8 Correct 112 ms 8024 KB Output is correct
9 Correct 102 ms 8080 KB Output is correct
10 Correct 123 ms 8080 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 8080 KB Output is correct
2 Correct 12 ms 8080 KB Output is correct
3 Correct 10 ms 8080 KB Output is correct
4 Correct 10 ms 8080 KB Output is correct
5 Correct 11 ms 8080 KB Output is correct
6 Correct 13 ms 8080 KB Output is correct
7 Correct 10 ms 8080 KB Output is correct
8 Correct 8 ms 8080 KB Output is correct
9 Correct 12 ms 8080 KB Output is correct
10 Correct 11 ms 8080 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 106 ms 8120 KB Output is correct - 120000 bits used
2 Correct 98 ms 8192 KB Output is correct - 122000 bits used
3 Correct 92 ms 8192 KB Output is correct - 125000 bits used
4 Correct 120 ms 8360 KB Output is correct - 125000 bits used
5 Correct 128 ms 8360 KB Output is correct - 125000 bits used
6 Correct 111 ms 8384 KB Output is correct - 125000 bits used
7 Correct 99 ms 8384 KB Output is correct - 124828 bits used
8 Correct 95 ms 8384 KB Output is correct - 124910 bits used
9 Correct 100 ms 8392 KB Output is correct - 125000 bits used
10 Correct 104 ms 8392 KB Output is correct - 125000 bits used