답안 #829657

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
829657 2023-08-18T13:52:17 Z AdamGS 최후의 만찬 (IOI12_supper) C++17
0 / 100
53 ms 6088 KB
#include "advisor.h"
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=1e5+7;
int kiedy[LIM], nxt[LIM], on[LIM], uzyte[2*LIM];
void ComputeAdvice(int *c, int n, int k, int m) {
	rep(i, n) kiedy[i]=n;
	for(int i=n-1; i>=0; --i) {
		nxt[i]=kiedy[c[i]];
		kiedy[c[i]]=i;
	}
	priority_queue<pair<int,pair<int,int>>>q;
	rep(i, k) {
		on[i]=1;
		q.push({kiedy[i], {i, i}});
	}
	rep(i, n) {
		if(!on[c[i]]) {
			int a=q.top().nd.st, b=q.top().nd.nd; q.pop();
			uzyte[b]=1;
			on[a]=0;
		}
		on[c[i]]=1;
		q.push({nxt[i], {c[i], i+k}});
	}
	rep(i, n) WriteAdvice(uzyte[i]);
}
#include "assistant.h"
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=1e5+7;
int xd[LIM];
void Assist(unsigned char *A, int n, int k, int r) {
	queue<int>q;
	rep(i, k) {
		xd[i]=1;
		if(A[i]) q.push(i);
	}
	rep(i, n) {
		int a=GetRequest();
		if(!xd[a]) {
			int p=q.front(); q.pop();
			PutBack(p);
			xd[a]=1;
			xd[p]=0;
		}	
		if(A[k+i]) q.push(a);
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 560 KB Output is correct
2 Incorrect 0 ms 512 KB Output isn't correct - not an optimal way
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 1228 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 53 ms 4532 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 932 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 46 ms 6064 KB Error - Putting back a color that is not on the scaffold
2 Incorrect 46 ms 5964 KB Error - Putting back a color that is not on the scaffold
3 Incorrect 47 ms 5952 KB Error - Putting back a color that is not on the scaffold
4 Incorrect 50 ms 5996 KB Error - Putting back a color that is not on the scaffold
5 Incorrect 52 ms 6088 KB Error - Putting back a color that is not on the scaffold
6 Incorrect 51 ms 5912 KB Error - Putting back a color that is not on the scaffold
7 Incorrect 45 ms 5952 KB Error - Putting back a color that is not on the scaffold
8 Incorrect 46 ms 6036 KB Error - Putting back a color that is not on the scaffold
9 Incorrect 47 ms 6064 KB Error - Putting back a color that is not on the scaffold
10 Incorrect 44 ms 5344 KB Error - Putting back a color that is not on the scaffold