답안 #67350

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
67350 2018-08-14T04:00:32 Z WA_TLE 최후의 만찬 (IOI12_supper) C++14
0 / 100
154 ms 27816 KB
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#define pub push_back
#define pob pop_back
#define mp make_pair
#define sec second
using namespace std;
//#include"grader.cpp"
const int mod=1e9+7;
//void WriteAdvice(unsigned char a) {};
#include"advisor.h"
void ComputeAdvice(int *C, int N, int K, int M) {
	static bool kta[200000]={};
	int i,j;
	priority_queue<pair<int,int>>que;
	//次いる日、入れたときの番号
	vector<vector<int>>need(N);
	for(i=0;i<N;i++){need[i].pub(mod);}
	for(i=N-1;i>=0;i--){need[C[i]].pub(i);}
	static bool tna[100000]={};
	for(i=0;i<K;i++){que.push(mp(need[i].back(),i));tna[i]=1;}
	for(i=0;i<N;i++){
		int use=C[i];
		need[use].pob();
		if(!tna[use]){
			pair<int,int> ksu;
			while(-1){
				ksu=que.top();que.pop();
				int ter;
				if(ksu.sec<K){ter=ksu.sec;}else{ter=C[ksu.sec-K];}
				if(tna[ter]){kta[ksu.sec]=1;tna[ter]=0;break;}
			}
			tna[use]=1;
		}
		que.push(mp(need[use].back(),i+K));
	}
	for(i=0;i<K+N;i++){WriteAdvice(kta[i]);}
}
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#define pub push_back
#define pob pop_back
#define mp make_pair
#define sec second
using namespace std;

#include "assistant.h"
void Assist(unsigned char *A, int N, int K, int R) {
	int i;
	deque<int>iran;
	static bool aru[100000]={};
	for(i=0;i<K;i++){if(A[i]){iran.pub(i);}aru[i]=1;}
	for(i=0;i<N;i++) {
		int req=GetRequest();
		if(!aru[req]){PutBack(iran.back());iran.pob();}
		if(A[i+K]){iran.pub(req);}
	}
}

Compilation message

advisor.cpp: In function 'void ComputeAdvice(int*, int, int, int)':
advisor.cpp:16:8: warning: unused variable 'j' [-Wunused-variable]
  int i,j;
        ^
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 752 KB Output is correct
2 Incorrect 4 ms 968 KB Error - Putting back a color when it is already on the scaffold
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 2712 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 104 ms 13440 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 13440 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 131 ms 18416 KB Error - Putting back a color when it is already on the scaffold
2 Incorrect 125 ms 19760 KB Error - Putting back a color when it is already on the scaffold
3 Incorrect 127 ms 21048 KB Error - Putting back a color when it is already on the scaffold
4 Incorrect 135 ms 21944 KB Error - Putting back a color when it is already on the scaffold
5 Incorrect 149 ms 23096 KB Error - Putting back a color when it is already on the scaffold
6 Incorrect 136 ms 24248 KB Error - Putting back a color when it is already on the scaffold
7 Incorrect 121 ms 25496 KB Error - Putting back a color when it is already on the scaffold
8 Incorrect 121 ms 26680 KB Error - Putting back a color when it is already on the scaffold
9 Incorrect 154 ms 27792 KB Error - Putting back a color when it is already on the scaffold
10 Runtime error 149 ms 27816 KB Execution killed with signal 11 (could be triggered by violating memory limits)