답안 #577228

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
577228 2022-06-14T09:52:05 Z WongChun1234 최후의 만찬 (IOI12_supper) C++14
0 / 100
390 ms 81792 KB
#include "advisor.h"
#include<bits/stdc++.h>
using namespace std;
int c[100050],curr[100050];
deque<int> ap[100050];
priority_queue<pair<int,int>> pq;
void ComputeAdvice(int *C, int n, int k, int m) {
	for (int i=0;i<n;i++) c[i]=C[i];
	for (int i=0;i<n;i++) ap[c[i]].push_back(i);
	for (int i=0;i<n;i++) ap[i].push_back(2e9);
	for (int i=0;i<k;i++) curr[i]=i,pq.push({ap[i][0],i});
	for (int i=k;i<n;i++) curr[i]=-1;
	for (int i=0;i<n;i++){
		int choice;
		if (curr[c[i]]!=-1){
			choice=32767;
		}else{
			choice=curr[c[i]]=curr[pq.top().second];
			curr[pq.top().second]=-1;
			pq.pop();
			while (ap[c[i]].front()<=i) ap[c[i]].pop_front();
			pq.push({ap[c[i]].front(),c[i]});
		}
		for (int j=0;j<15;j++) WriteAdvice((choice>>j)&1);
	}
}
#include "assistant.h"

int pos[100050];
void Assist(unsigned char *A, int n, int k, int R) {
	for (int i=0;i<k;i++) pos[i]=i;
	for (int i=k;i<n;i++) pos[i]=-1;
	for (int i=0;i<n;i++){
		int nxt=GetRequest();
		int choice=0;
		for (int j=0;j<15;j++) choice+=A[i*15+j]<<j;
		if (choice==32767){
		}else{
			PutBack(pos[choice]);
			pos[choice]=nxt;
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 67756 KB Output is correct
2 Incorrect 41 ms 68068 KB Output isn't correct - not an optimal way
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 69 ms 69204 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 291 ms 78880 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 40 ms 67916 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 330 ms 81400 KB Output isn't correct - not an optimal way
2 Incorrect 345 ms 81488 KB Output isn't correct - not an optimal way
3 Incorrect 390 ms 81700 KB Output isn't correct - not an optimal way
4 Incorrect 330 ms 81392 KB Output isn't correct - not an optimal way
5 Incorrect 330 ms 81564 KB Output isn't correct - not an optimal way
6 Incorrect 334 ms 81496 KB Output isn't correct - not an optimal way
7 Incorrect 338 ms 81600 KB Output isn't correct - not an optimal way
8 Incorrect 322 ms 81460 KB Output isn't correct - not an optimal way
9 Incorrect 322 ms 81792 KB Output isn't correct - not an optimal way
10 Correct 320 ms 81456 KB Output is partially correct - 1500000 bits used