답안 #58860

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
58860 2018-07-19T16:36:06 Z IvanC 최후의 만찬 (IOI12_supper) C++17
20 / 100
1051 ms 42728 KB
#include <bits/stdc++.h>
#include "advisor.h"
using namespace std;

void ComputeAdvice(int *C, int N, int K, int M) {
	
	for(int vez = 0;vez<N;vez++){
		
		int numero = C[vez];
		for(int i = 0;(1 << i) <= N;i++){
			if(numero & (1 << i)) WriteAdvice(1);
			else WriteAdvice(0);
		}
		
	}

	

}
#include <bits/stdc++.h>
#include "assistant.h"
using namespace std;
 
typedef pair<int,int> ii;
 
void Assist(unsigned char *A, int N, int K, int R) {
 
	int ptr = 0;
	map<int,int> last,atual;
	vector<int> sequencia,vaiprecisar;
	set<ii> sca;
	set<int> defato;
	
	for(int i = 0;i<=N;i++) last[i] = N + 1;
	
	for(int i = 0;i<N;i++){
		int numero = 0;
		for(int j = 0;(1 << j) <= N;j++){
			if(A[ptr] == 1) numero += (1 <<  j);
			ptr++; 
		}
		sequencia.push_back(numero);
	}
	for(int i = N-1;i>=0;i--){
		int v = sequencia[i];
		vaiprecisar.push_back(last[v]);
		last[v] = i;
	}
	reverse(vaiprecisar.begin(),vaiprecisar.end());
	//for(int i = 0;i<N;i++){
	//	printf("Foi %d %d\n",sequencia[i],vaiprecisar[i]);
	//}
 
	for(int i = 0;i<K;i++){
		ii davez = ii(-last[i],i);
		sca.insert(davez);
		atual[i] = last[i];
		defato.insert(i);
	}
 
	for(int i = 0;i<N;i++){
		
		int v = sequencia[i];
		
		int checagem = GetRequest();
		
		if(defato.count(v)){
			ii antigo = ii(-last[v],v);
			last[v] = vaiprecisar[i];
			ii novo = ii(-vaiprecisar[i],v);
			sca.erase(antigo);
			sca.insert(novo);
		}
		else{
			
			ii perdeu = *(sca.begin());
			sca.erase(perdeu);
			defato.erase(perdeu.second);
			PutBack(perdeu.second);
			
			last[v] = vaiprecisar[i];
			ii novo = ii(-vaiprecisar[i],v);
			sca.insert(novo);
			defato.insert(v);
		}
		
	}
 
}

Compilation message

assistant.cpp: In function 'void Assist(unsigned char*, int, int, int)':
assistant.cpp:46:7: warning: unused variable 'checagem' [-Wunused-variable]
   int checagem = GetRequest();
       ^~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 608 KB Output is correct
2 Correct 6 ms 900 KB Output is correct
3 Correct 11 ms 1464 KB Output is correct
4 Correct 20 ms 1592 KB Output is correct
5 Correct 27 ms 1892 KB Output is correct
6 Correct 31 ms 2348 KB Output is correct
7 Correct 33 ms 2536 KB Output is correct
8 Correct 44 ms 2600 KB Output is correct
9 Correct 37 ms 2640 KB Output is correct
10 Correct 33 ms 2800 KB Output is correct
11 Correct 36 ms 2980 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 59 ms 3824 KB Output is correct
2 Correct 385 ms 11260 KB Output is correct
3 Correct 977 ms 26012 KB Output is correct
4 Correct 657 ms 36600 KB Output is correct
5 Correct 659 ms 36600 KB Output is correct
6 Correct 744 ms 36600 KB Output is correct
7 Correct 760 ms 36608 KB Output is correct
8 Correct 688 ms 36616 KB Output is correct
9 Correct 660 ms 36616 KB Output is correct
10 Correct 983 ms 39672 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 616 ms 42728 KB Output is correct
2 Incorrect 41 ms 42728 KB Error - advice is too long
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 42728 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 898 ms 42728 KB Output is partially correct - 1700000 bits used
2 Partially correct 903 ms 42728 KB Output is partially correct - 1700000 bits used
3 Partially correct 1051 ms 42728 KB Output is partially correct - 1700000 bits used
4 Partially correct 765 ms 42728 KB Output is partially correct - 1700000 bits used
5 Partially correct 925 ms 42728 KB Output is partially correct - 1700000 bits used
6 Partially correct 917 ms 42728 KB Output is partially correct - 1700000 bits used
7 Partially correct 970 ms 42728 KB Output is partially correct - 1697263 bits used
8 Partially correct 928 ms 42728 KB Output is partially correct - 1700000 bits used
9 Partially correct 872 ms 42728 KB Output is partially correct - 1700000 bits used
10 Partially correct 796 ms 42728 KB Output is partially correct - 1700000 bits used