답안 #1017913

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1017913 2024-07-09T11:24:47 Z NintsiChkhaidze 최후의 만찬 (IOI12_supper) C++17
20 / 100
300 ms 114676 KB
#include <bits/stdc++.h>
#include "advisor.h"
using namespace std;

void ComputeAdvice(int *C, int N, int K, int M) {
	int bt = log2(N);
//	cout<<"bt ="<<bt<<endl;
	
	for (int i=0;i<N;i++){
		int x = C[i];
		for (int j = bt; 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 bt = log2(N);
//	cout<<bt<<endl;
	
	int id=0;
	for (int i = 0; i < R; i += bt + 1){
		for (int j = i; j <= i + bt; j++){
			if (A[j] == 1) CC[id] |= (1<<(bt-(j-i)));
		}
		id+=1;
	}
	
	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]) {
    		int val = 0;
			if (!st[req].size()) val=1e9;
			else val=*st[req].begin();
			stt.erase(stt.find({val,req}));
			
			while (st[req].size() && *st[req].begin() <= i){
    			st[req].erase(st[req].begin());
			}
			val = 0;
			if (!st[req].size()) val=1e9;
			else val=*st[req].begin();
			stt.insert({val,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 31 ms 94740 KB Output is correct
2 Correct 38 ms 94632 KB Output is correct
3 Correct 41 ms 94704 KB Output is correct
4 Correct 37 ms 94860 KB Output is correct
5 Correct 40 ms 95256 KB Output is correct
6 Correct 41 ms 95468 KB Output is correct
7 Correct 43 ms 95352 KB Output is correct
8 Correct 40 ms 95388 KB Output is correct
9 Correct 40 ms 95336 KB Output is correct
10 Correct 40 ms 95540 KB Output is correct
11 Correct 40 ms 95388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 96436 KB Output is correct
2 Correct 142 ms 103836 KB Output is correct
3 Correct 267 ms 114676 KB Output is correct
4 Correct 269 ms 113236 KB Output is correct
5 Correct 286 ms 113236 KB Output is correct
6 Correct 265 ms 113492 KB Output is correct
7 Correct 300 ms 113820 KB Output is correct
8 Correct 234 ms 111320 KB Output is correct
9 Correct 252 ms 111624 KB Output is correct
10 Correct 279 ms 113564 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 227 ms 109376 KB Output is correct
2 Incorrect 46 ms 97624 KB Error - advice is too long
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 32 ms 94580 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 278 ms 112976 KB Output is partially correct - 1700000 bits used
2 Correct 274 ms 113112 KB Output is partially correct - 1700000 bits used
3 Correct 276 ms 113180 KB Output is partially correct - 1700000 bits used
4 Correct 278 ms 113328 KB Output is partially correct - 1700000 bits used
5 Correct 276 ms 113228 KB Output is partially correct - 1700000 bits used
6 Correct 270 ms 113240 KB Output is partially correct - 1700000 bits used
7 Correct 288 ms 113228 KB Output is partially correct - 1697263 bits used
8 Correct 277 ms 113364 KB Output is partially correct - 1700000 bits used
9 Correct 273 ms 113192 KB Output is partially correct - 1700000 bits used
10 Correct 264 ms 113248 KB Output is partially correct - 1700000 bits used