답안 #804595

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
804595 2023-08-03T10:03:14 Z Dan4Life 최후의 만찬 (IOI12_supper) C++17
0 / 100
101 ms 11008 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;
  }
  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(1);
	}
	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;
	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!=(1<<16)-1) PutBack(a[p]), a[p]=req;
	}
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 636 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 36 ms 3060 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 64 ms 8808 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 980 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 78 ms 10400 KB Error - advice is too long
2 Incorrect 78 ms 10552 KB Error - advice is too long
3 Incorrect 92 ms 10932 KB Error - advice is too long
4 Incorrect 85 ms 10816 KB Error - advice is too long
5 Incorrect 77 ms 10928 KB Error - advice is too long
6 Incorrect 77 ms 11008 KB Error - advice is too long
7 Incorrect 84 ms 10788 KB Error - advice is too long
8 Incorrect 101 ms 10944 KB Error - advice is too long
9 Incorrect 80 ms 10820 KB Error - advice is too long
10 Incorrect 90 ms 10904 KB Error - advice is too long