답안 #23779

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
23779 2017-05-25T20:05:08 Z Hiasat 최후의 만찬 (IOI12_supper) C++14
0 / 100
59 ms 7648 KB
#include <bits/stdc++.h>
#include "advisor.h"

using namespace std;

void ComputeAdvice(int *C, int N, int K, int M) {
	for (int i = 0; i < N; ++i){
		for(int k = 19; k >= 0 ; k--){
			bool r = C[i]&(1<<k);
			WriteAdvice(r);
		}
	}
}
#include <bits/stdc++.h>
#include "assistant.h"

using namespace std;

typedef pair<int,int> pii;

vector<int> nxt[100001];

int n , k , r;

bool have[100001];

int go(int color,int cur){
	vector<int>::iterator it = upper_bound(nxt[color].begin(),nxt[color].end(),cur);
	if(it == nxt[color].end())
		return n;
	return *it;
}
void Assist(unsigned char *A, int N, int K, int R) {
	n = N;
	k = K;
	r = R;
	for (int i = 0; i < N; ++i) {
		int num = 0;
		for (int k = 19 ; k >= 0 ; k--) {
			num += A[i * 20 + (19 - k)] * (1 << k);
		}
		nxt[num].push_back(i);
	}
	priority_queue< pii > q;
	for (int i = 0; i < K; ++i){
		have[i] = 1;
		q.push(make_pair(go(i,-1),i));
	}
	for (int i = 0; i < N; i++) {
		int req = GetRequest();
		if(have[req])
			continue;
		pii src = q.top();
		q.pop();
		PutBack(src.second);
		have[src.second] = 0;
		have[req] = 1;
		q.push(make_pair(go(req,i),req));
	}

}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 3292 KB Output is correct
2 Incorrect 6 ms 5832 KB Output isn't correct - not an optimal way
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 59 ms 6740 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 24 ms 7648 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 7648 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 29 ms 7648 KB Error - advice is too long
2 Incorrect 29 ms 7648 KB Error - advice is too long
3 Incorrect 31 ms 7648 KB Error - advice is too long
4 Incorrect 28 ms 7648 KB Error - advice is too long
5 Incorrect 27 ms 7648 KB Error - advice is too long
6 Incorrect 27 ms 7648 KB Error - advice is too long
7 Incorrect 27 ms 7648 KB Error - advice is too long
8 Incorrect 28 ms 7648 KB Error - advice is too long
9 Incorrect 28 ms 7648 KB Error - advice is too long
10 Incorrect 28 ms 7648 KB Error - advice is too long