Submission #58853

# Submission time Handle Problem Language Result Execution time Memory
58853 2018-07-19T16:19:07 Z IvanC Last supper (IOI12_supper) C++17
0 / 100
509 ms 24528 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<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:40:7: warning: unused variable 'checagem' [-Wunused-variable]
   int checagem = GetRequest();
       ^~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 868 KB Error - Not putting back color when it is not on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 2412 KB Error - Not putting back color when it is not on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 389 ms 15016 KB Error - Not putting back color when it is not on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 19304 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 440 ms 20860 KB Error - Not putting back color when it is not on the scaffold
2 Incorrect 428 ms 22928 KB Error - Not putting back color when it is not on the scaffold
3 Incorrect 484 ms 23856 KB Error - Not putting back color when it is not on the scaffold
4 Incorrect 493 ms 24328 KB Error - Not putting back color when it is not on the scaffold
5 Incorrect 475 ms 24432 KB Error - Not putting back color when it is not on the scaffold
6 Incorrect 505 ms 24484 KB Error - Not putting back color when it is not on the scaffold
7 Incorrect 458 ms 24508 KB Error - Not putting back color when it is not on the scaffold
8 Incorrect 437 ms 24528 KB Error - Not putting back color when it is not on the scaffold
9 Incorrect 502 ms 24528 KB Error - Not putting back color when it is not on the scaffold
10 Incorrect 509 ms 24528 KB Error - Not putting back color when it is not on the scaffold