Submission #272060

# Submission time Handle Problem Language Result Execution time Memory
272060 2020-08-18T08:31:04 Z 송준혁(#5108) Last supper (IOI12_supper) C++14
0 / 100
97 ms 8712 KB
#include "advisor.h"
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

static int A[202020], X[202020], R[101010];
static int B[202020];
static priority_queue<pii> PQ;

void ComputeAdvice(int *C, int N, int K, int M) {
	for (int i=0; i<K; i++) A[i]=i;
	for (int i=0; i<N; i++) A[i+K]=C[i], R[i]=N+K;
	for (int i=N+K-1; i>=0; i--) X[i]=R[A[i]], R[A[i]]=i;
	memset(R, -1, sizeof R);
	for (int i=0; i<K; i++) PQ.push(pii(X[i], i)), R[i]=i;
	for (int i=K; i<K+N; i++){
		if (R[A[i]]<0){
			while (R[A[PQ.top().se]] != PQ.top().se) PQ.pop();
			B[PQ.top().se]=1, R[PQ.top().se]=-1;
			PQ.pop();
		}
		R[A[i]]=i, PQ.push(pii(X[i], i));
	}
	for (int i=0; i<K+N; i++) WriteAdvice(B[i]);
}
#include "assistant.h"
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

static bool chk[101010];
static queue<int> E;

void Assist(unsigned char *A, int N, int K, int R) {
	for (int i=0; i<K; i++){
		if (A[i]) E.push(i);
		chk[i]=true;
	}
	for (int i=0; i<N; i++){
		int x=GetRequest();
		if (!chk[x]) PutBack(E.front()), E.pop();
		if (A[i+K]) E.push(x);
		else chk[x]=true;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1536 KB Output is correct
2 Correct 1 ms 1536 KB Output is correct
3 Correct 2 ms 1536 KB Output is correct
4 Incorrect 3 ms 1792 KB Error - Putting back a color that is not on the scaffold
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 2304 KB Error - Not putting back color when it is not on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 67 ms 7136 KB Output is correct
2 Correct 84 ms 8712 KB Output is correct
3 Correct 94 ms 8408 KB Output is correct
4 Correct 87 ms 8664 KB Output is correct
5 Incorrect 81 ms 8680 KB Error - Not putting back color when it is not on the scaffold
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1792 KB Output is correct
2 Incorrect 5 ms 1856 KB Output isn't correct - not an optimal way
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 91 ms 8232 KB Error - Not putting back color when it is not on the scaffold
2 Correct 97 ms 8408 KB Output is correct - 122000 bits used
3 Correct 84 ms 8408 KB Output is correct - 125000 bits used
4 Correct 84 ms 8408 KB Output is correct - 125000 bits used
5 Correct 89 ms 8408 KB Output is correct - 125000 bits used
6 Correct 84 ms 8664 KB Output is correct - 125000 bits used
7 Correct 83 ms 8408 KB Output is correct - 124828 bits used
8 Correct 84 ms 8408 KB Output is correct - 124910 bits used
9 Correct 83 ms 8408 KB Output is correct - 125000 bits used
10 Incorrect 82 ms 8160 KB Error - Not putting back color when it is not on the scaffold