답안 #23780

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

using namespace std;

void ComputeAdvice(int *C, int N, int K, int M) {
	int bits = M/N;
	bits = min(bits,17);
	for (int i = 0; i < N; ++i){
		for(int k = bits-1; 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;
	int bits = min(17,R/N);
	for (int i = 0; i < N; ++i) {
		int num = 0;
		for (int k = bits-1 ; k >= 0 ; k--) {
			num += A[i * bits + ((bits-1) - 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 3172 KB Output is correct
2 Incorrect 6 ms 5716 KB Output isn't correct - not an optimal way
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 60 ms 6876 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 336 ms 15280 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 19760 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 390 ms 21308 KB Output isn't correct - not an optimal way
2 Incorrect 406 ms 22968 KB Output isn't correct - not an optimal way
3 Incorrect 412 ms 23080 KB Output isn't correct - not an optimal way
4 Incorrect 427 ms 23080 KB Output isn't correct - not an optimal way
5 Incorrect 399 ms 23080 KB Output isn't correct - not an optimal way
6 Incorrect 432 ms 23080 KB Output isn't correct - not an optimal way
7 Incorrect 447 ms 23080 KB Output isn't correct - not an optimal way
8 Incorrect 438 ms 23212 KB Output isn't correct - not an optimal way
9 Incorrect 441 ms 23344 KB Output isn't correct - not an optimal way
10 Partially correct 434 ms 24436 KB Output is partially correct - 1700000 bits used