답안 #804596

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
804596 2023-08-03T10:04:29 Z Dan4Life 최후의 만찬 (IOI12_supper) C++17
0 / 100
102 ms 11076 KB
#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;
 
void ComputeAdvice(int *C, int N, int K, int M) {
  set<int> S; set<pair<int,int>> SS; 
  vector<int> v[N+1]; int pos[N+1];
  for(int i = 0; i < N; i++) v[C[i]].push_back(i);
  for(int i = 0; i < N; i++) v[i].push_back(N+1);
  for(int i = 0; i < K; i++){
	  int nx = *upper_bound(begin(v[i]),end(v[i]),-1);
	  S.insert(i); SS.insert({nx,i}); pos[i]=i+1;
  }
  for(int i = 0; i < N; i++) {
	int req = C[i];
	if(S.count(req)){
		int nx = *upper_bound(begin(v[req]),end(v[req]),i);
		SS.erase({i,req}); SS.insert({nx,req}); 
		for(int j = 0; j < 15; j++) WriteAdvice(0);
	}
	int getCol = (--end(SS))->second; pos[req] = pos[getCol];
	for(int j = 0; j < 15; j++) WriteAdvice((pos[getCol]>>j)&1);
	S.erase(getCol); S.insert(req);
	int nx = *upper_bound(begin(v[req]),end(v[req]),i);
	SS.erase(--end(SS)); SS.insert({nx,req});
  }
}
#include "assistant.h"
#include <bits/stdc++.h>
using namespace std;
 
void Assist(unsigned char *A, int N, int K, int R) {
	int a[K+1]; for(int i = 0; i < K; i++) a[i] = i+1;
	for(int i = 0; i < N; i++){
		int req = GetRequest();
		int p = 0; for(int j = 0; j < 15; j++) if(A[15*i+j]) p|=(1<<j);
		if(p) PutBack(a[p]), a[p]=req;
	}
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 636 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 35 ms 2688 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 74 ms 8808 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 900 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 74 ms 10396 KB Error - advice is too long
2 Incorrect 75 ms 10624 KB Error - advice is too long
3 Incorrect 89 ms 11076 KB Error - advice is too long
4 Incorrect 83 ms 10964 KB Error - advice is too long
5 Incorrect 76 ms 10796 KB Error - advice is too long
6 Incorrect 77 ms 11044 KB Error - advice is too long
7 Incorrect 80 ms 10920 KB Error - advice is too long
8 Incorrect 76 ms 10796 KB Error - advice is too long
9 Incorrect 102 ms 10844 KB Error - advice is too long
10 Incorrect 70 ms 10784 KB Error - advice is too long