Submission #58855

# Submission time Handle Problem Language Result Execution time Memory
58855 2018-07-19T16:25:34 Z IvanC Last supper (IOI12_supper) C++17
0 / 100
957 ms 40564 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++){
		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:43:7: warning: unused variable 'checagem' [-Wunused-variable]
   int checagem = GetRequest();
       ^~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 616 KB Output is correct
2 Correct 6 ms 1176 KB Output is correct
3 Correct 10 ms 1444 KB Output is correct
4 Incorrect 17 ms 1624 KB Output isn't correct - not an optimal way
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 79 ms 3004 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 659 ms 17852 KB Output is correct
2 Incorrect 40 ms 23984 KB Error - advice is too long
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 23984 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 844 ms 27388 KB Output isn't correct - not an optimal way
2 Partially correct 747 ms 31640 KB Output is partially correct - 1700000 bits used
3 Partially correct 923 ms 33576 KB Output is partially correct - 1700000 bits used
4 Partially correct 747 ms 35240 KB Output is partially correct - 1700000 bits used
5 Partially correct 875 ms 36392 KB Output is partially correct - 1700000 bits used
6 Partially correct 822 ms 37640 KB Output is partially correct - 1700000 bits used
7 Partially correct 818 ms 38864 KB Output is partially correct - 1697263 bits used
8 Partially correct 957 ms 39416 KB Output is partially correct - 1700000 bits used
9 Partially correct 889 ms 39416 KB Output is partially correct - 1700000 bits used
10 Incorrect 845 ms 40564 KB Output isn't correct - not an optimal way