답안 #1017910

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1017910 2024-07-09T11:19:46 Z NintsiChkhaidze 최후의 만찬 (IOI12_supper) C++17
0 / 100
54 ms 97872 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++){
		int x = C[i];
		for (int j = 19; j >= 0; j--){
			if (((x >> j) & 1)) WriteAdvice(1);
			else WriteAdvice(0);
		}
	}
	
}
#include <bits/stdc++.h>
#include "assistant.h"
using namespace std;

const int MM = 2e6 + 5;
int CC[MM];
bool on[MM];
set <int> st[MM];
void Assist(unsigned char *A, int N, int K, int R) {
	
	int id=0;
	for (int i = 0; i < R; i += 20){
		for (int j = i; j <= i + 19; j++){
			if (A[j] == 1) CC[id] |= (1<<(19-(j-i)));
		}
		id+=1;
	}
	
	/*
	cout<<"Here"<<endl;
	for (int i=0;i<id;i++)
		cout<<CC[i]<<" ";
	cout<<endl;*/
	
	for (int i=id-1;i>=0;i--){
		st[CC[i]].insert(i);
	}
	
	set <pair<int,int> > stt;
	for (int i=0;i<K;i++){
		on[i] = 1;
		int val = 0;
		if (!st[i].size()) val=1e9;
		else val=*st[i].begin();
		stt.insert({val,i});
	}
	
	int i;
	for (i = 0; i < N; i++) {
    	int req = GetRequest();
    	if (on[req]) continue;
    	
		int idx=(--stt.end())->second;
		PutBack(idx);
		on[idx] = 0;
		stt.erase(--stt.end());
		on[req] = 1;
		
		while (st[req].size() && *st[req].begin() <= i){
    		st[req].erase(st[req].begin());
		}
		
		int val = 0;
		if (!st[req].size()) val=1e9;
		else val=*st[req].begin();
		stt.insert({val,req});
  	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 94748 KB Output is correct
2 Incorrect 31 ms 94700 KB Output isn't correct - not an optimal way
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 54 ms 96828 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 42 ms 97504 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 31 ms 94524 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 48 ms 97804 KB Error - advice is too long
2 Incorrect 48 ms 97716 KB Error - advice is too long
3 Incorrect 45 ms 97728 KB Error - advice is too long
4 Incorrect 46 ms 97872 KB Error - advice is too long
5 Incorrect 49 ms 97784 KB Error - advice is too long
6 Incorrect 45 ms 97800 KB Error - advice is too long
7 Incorrect 45 ms 97772 KB Error - advice is too long
8 Incorrect 45 ms 97820 KB Error - advice is too long
9 Incorrect 45 ms 97724 KB Error - advice is too long
10 Incorrect 52 ms 97636 KB Error - advice is too long