답안 #69081

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
69081 2018-08-19T23:07:48 Z IvanC Broken Device (JOI17_broken_device) C++17
0 / 100
107 ms 3920 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 150;

static int possivel[MAXN],resposta[MAXN];

void Anna( int N, long long X, int K, int P[] ){

	memset(possivel,1,sizeof(possivel));
	memset(resposta,0,sizeof(resposta));
	possivel[N] = 0;

	for(int i = 0;i<K;i++) possivel[P[i]] = 0;

	deque<int> digitos;
	while(X != 0){
		digitos.push_back(X % 2);
		X /= 2;
	}
	for(int i = 0;i<100;i++) digitos.push_back(0);

	for(int i = 0;i+2<N;i+=3){
		int nao_pode = (possivel[i] + 2*possivel[i+1] + 4*possivel[i+2]) ^ 7;
		int best_qtd = 0,mascara = 0;
		if(!(nao_pode & 4) && digitos[0] == 1){
			best_qtd = 1;
			mascara = 4;
		}
		if(!(nao_pode & 2) && digitos[0] == 0){
			best_qtd = 1;
			mascara = 2;
		}
		if(!(nao_pode & 3) && digitos[0] == 1){
			best_qtd = 1;
			mascara = 3;
		}
		if(!(nao_pode & 7) && digitos[0] == 1 && digitos[1] == 1){
			best_qtd = 2;
			mascara = 7;
		}
		if(!(nao_pode & 5) && digitos[0] == 0 && digitos[1] == 1){
			best_qtd = 2;
			mascara = 5;
		}
		if(!(nao_pode & 1) && digitos[0] == 0 && digitos[1] == 0){
			best_qtd = 2;
			mascara = 1;
		}
		if(!(nao_pode & 6) && digitos[0] == 1 && digitos[1] == 0){
			best_qtd = 2;
			mascara = 6;
		}
		for(int j = 0;j<best_qtd;j++) digitos.pop_front();
		resposta[i] = (mascara & 1) != 0;
		resposta[i+1] = (mascara & 2) != 0;
		resposta[i+2] = (mascara & 4) != 0;
	}

	for(int i = 0;i<N;i++){
		Set( i, resposta[i] );
	}

}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;

long long Bruno( int N, int A[] ){

	vector<int> digitos;
	long long ans = 0;

	for(int i = 0;i+2<N;i+=3){
		int numero = A[i] + 2*A[i+1] + 4*A[i+2];
		if(numero == 0) continue;
		if(numero == 4 || numero == 6 || numero == 5 || numero == 3 || numero == 7){
			digitos.push_back(1);
			if(numero == 4 || numero == 3) continue;
			if(numero == 7) digitos.push_back(1);
			else digitos.push_back(0);
		}
		else{
			digitos.push_back(0);
			if(numero == 2) continue;
			if(numero == 1) digitos.push_back(0);
			else digitos.push_back(1);
		}
	}

	while(!digitos.empty() && digitos.back() == 0){
		digitos.pop_back();
	}
	for(int i = 0;i<digitos.size();i++){
		if(digitos[i]) ans += (1LL << i);
	}

	return ans;

}

Compilation message

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:30:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0;i<digitos.size();i++){
                ~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 53 ms 3056 KB Output isn't correct - L* = 0
2 Incorrect 47 ms 3264 KB Output isn't correct - L* = 0
3 Incorrect 47 ms 3376 KB Output isn't correct - L* = 0
4 Incorrect 52 ms 3520 KB Output isn't correct - L* = 0
5 Incorrect 75 ms 3584 KB Output isn't correct - L* = 0
6 Incorrect 51 ms 3680 KB Output isn't correct - L* = 0
7 Incorrect 55 ms 3744 KB Output isn't correct - L* = 0
8 Incorrect 45 ms 3744 KB Output isn't correct - L* = 0
9 Incorrect 47 ms 3744 KB Output isn't correct - L* = 0
10 Incorrect 54 ms 3744 KB Output isn't correct - L* = 0
11 Incorrect 49 ms 3744 KB Output isn't correct - L* = 0
12 Incorrect 47 ms 3744 KB Output isn't correct - L* = 0
13 Incorrect 53 ms 3744 KB Output isn't correct - L* = 0
14 Incorrect 61 ms 3744 KB Output isn't correct - L* = 0
15 Incorrect 47 ms 3744 KB Output isn't correct - L* = 0
16 Incorrect 107 ms 3744 KB Output isn't correct - L* = 0
17 Incorrect 49 ms 3744 KB Output isn't correct - L* = 0
18 Incorrect 62 ms 3744 KB Output isn't correct - L* = 0
19 Incorrect 74 ms 3744 KB Output isn't correct - L* = 0
20 Incorrect 45 ms 3744 KB Output isn't correct - L* = 0
21 Incorrect 44 ms 3744 KB Output isn't correct - L* = 0
22 Incorrect 55 ms 3744 KB Output isn't correct - L* = 0
23 Incorrect 51 ms 3744 KB Output isn't correct - L* = 0
24 Incorrect 59 ms 3744 KB Output isn't correct - L* = 0
25 Incorrect 48 ms 3744 KB Output isn't correct - L* = 0
26 Incorrect 48 ms 3744 KB Output isn't correct - L* = 0
27 Incorrect 56 ms 3744 KB Output isn't correct - L* = 0
28 Incorrect 51 ms 3744 KB Output isn't correct - L* = 0
29 Incorrect 54 ms 3744 KB Output isn't correct - L* = 0
30 Incorrect 49 ms 3744 KB Output isn't correct - L* = 0
31 Incorrect 52 ms 3744 KB Output isn't correct - L* = 0
32 Incorrect 54 ms 3752 KB Output isn't correct - L* = 0
33 Incorrect 53 ms 3752 KB Output isn't correct - L* = 0
34 Incorrect 52 ms 3752 KB Output isn't correct - L* = 0
35 Incorrect 48 ms 3920 KB Output isn't correct - L* = 0
36 Incorrect 59 ms 3920 KB Output isn't correct - L* = 0
37 Incorrect 52 ms 3920 KB Output isn't correct - L* = 0
38 Incorrect 56 ms 3920 KB Output isn't correct - L* = 0
39 Incorrect 53 ms 3920 KB Output isn't correct - L* = 0
40 Incorrect 50 ms 3920 KB Output isn't correct - L* = 0