답안 #69079

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
69079 2018-08-19T22:01:40 Z IvanC Broken Device (JOI17_broken_device) C++17
41 / 100
78 ms 4072 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+1<N && !digitos.empty();i+=2){
		if(digitos.front() == 0){
			if(!possivel[i+1]) continue;
			resposta[i] = 0;
			resposta[i+1] = 1;
			digitos.pop_front();
			if(!possivel[i] || digitos.front() != 0) continue;
			resposta[i] = 1;
			digitos.pop_front();
		}
		else{
			if(!possivel[i]) continue;
			resposta[i] = 1;
			resposta[i+1] = 0;
			digitos.pop_front();
		}
	}

	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+1<N;i+=2){
		int numero = A[i] + 2*A[i+1];
		if(numero == 1){
			digitos.push_back(1);
		}
		else if(numero == 2){
			digitos.push_back(0);
		}
		else if(numero == 3){
			digitos.push_back(0);
			digitos.push_back(0);
		}
	}

	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:27:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0;i<digitos.size();i++){
                ~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 45 ms 3056 KB Output is partially correct - L* = 24
2 Partially correct 48 ms 3368 KB Output is partially correct - L* = 16
3 Partially correct 48 ms 3552 KB Output is partially correct - L* = 18
4 Partially correct 47 ms 3584 KB Output is partially correct - L* = 21
5 Partially correct 52 ms 3792 KB Output is partially correct - L* = 17
6 Partially correct 57 ms 3792 KB Output is partially correct - L* = 20
7 Partially correct 47 ms 3792 KB Output is partially correct - L* = 18
8 Partially correct 45 ms 3792 KB Output is partially correct - L* = 25
9 Partially correct 46 ms 3840 KB Output is partially correct - L* = 19
10 Partially correct 64 ms 3840 KB Output is partially correct - L* = 16
11 Partially correct 48 ms 3840 KB Output is partially correct - L* = 19
12 Partially correct 53 ms 3840 KB Output is partially correct - L* = 22
13 Partially correct 52 ms 3840 KB Output is partially correct - L* = 19
14 Partially correct 52 ms 4072 KB Output is partially correct - L* = 19
15 Partially correct 61 ms 4072 KB Output is partially correct - L* = 16
16 Partially correct 53 ms 4072 KB Output is partially correct - L* = 17
17 Partially correct 53 ms 4072 KB Output is partially correct - L* = 23
18 Partially correct 70 ms 4072 KB Output is partially correct - L* = 17
19 Partially correct 78 ms 4072 KB Output is partially correct - L* = 19
20 Partially correct 53 ms 4072 KB Output is partially correct - L* = 18
21 Partially correct 48 ms 4072 KB Output is partially correct - L* = 15
22 Partially correct 46 ms 4072 KB Output is partially correct - L* = 18
23 Partially correct 48 ms 4072 KB Output is partially correct - L* = 19
24 Partially correct 52 ms 4072 KB Output is partially correct - L* = 17
25 Partially correct 58 ms 4072 KB Output is partially correct - L* = 22
26 Partially correct 44 ms 4072 KB Output is partially correct - L* = 16
27 Partially correct 52 ms 4072 KB Output is partially correct - L* = 18
28 Partially correct 49 ms 4072 KB Output is partially correct - L* = 16
29 Partially correct 46 ms 4072 KB Output is partially correct - L* = 16
30 Partially correct 48 ms 4072 KB Output is partially correct - L* = 21
31 Partially correct 47 ms 4072 KB Output is partially correct - L* = 16
32 Partially correct 73 ms 4072 KB Output is partially correct - L* = 20
33 Partially correct 72 ms 4072 KB Output is partially correct - L* = 17
34 Partially correct 46 ms 4072 KB Output is partially correct - L* = 18
35 Partially correct 44 ms 4072 KB Output is partially correct - L* = 15
36 Partially correct 49 ms 4072 KB Output is partially correct - L* = 20
37 Partially correct 49 ms 4072 KB Output is partially correct - L* = 21
38 Partially correct 45 ms 4072 KB Output is partially correct - L* = 24
39 Partially correct 45 ms 4072 KB Output is partially correct - L* = 18
40 Partially correct 47 ms 4072 KB Output is partially correct - L* = 15