답안 #69075

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
69075 2018-08-19T21:55:52 Z IvanC Broken Device (JOI17_broken_device) C++17
41 / 100
77 ms 4064 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();
		}
		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);
		}
	}

	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:23:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0;i<digitos.size();i++){
                ~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 46 ms 3056 KB Output is partially correct - L* = 17
2 Partially correct 45 ms 3576 KB Output is partially correct - L* = 16
3 Partially correct 45 ms 3576 KB Output is partially correct - L* = 18
4 Partially correct 46 ms 3720 KB Output is partially correct - L* = 17
5 Partially correct 60 ms 3728 KB Output is partially correct - L* = 17
6 Partially correct 47 ms 3800 KB Output is partially correct - L* = 20
7 Partially correct 50 ms 3800 KB Output is partially correct - L* = 18
8 Partially correct 50 ms 3800 KB Output is partially correct - L* = 18
9 Partially correct 45 ms 3800 KB Output is partially correct - L* = 18
10 Partially correct 54 ms 3800 KB Output is partially correct - L* = 16
11 Partially correct 53 ms 3800 KB Output is partially correct - L* = 17
12 Partially correct 47 ms 3840 KB Output is partially correct - L* = 22
13 Partially correct 48 ms 3840 KB Output is partially correct - L* = 18
14 Partially correct 50 ms 3840 KB Output is partially correct - L* = 18
15 Partially correct 67 ms 3840 KB Output is partially correct - L* = 16
16 Partially correct 47 ms 3840 KB Output is partially correct - L* = 17
17 Partially correct 77 ms 3840 KB Output is partially correct - L* = 22
18 Partially correct 57 ms 3840 KB Output is partially correct - L* = 16
19 Partially correct 47 ms 3840 KB Output is partially correct - L* = 18
20 Partially correct 48 ms 3840 KB Output is partially correct - L* = 18
21 Partially correct 68 ms 4064 KB Output is partially correct - L* = 15
22 Partially correct 57 ms 4064 KB Output is partially correct - L* = 16
23 Partially correct 54 ms 4064 KB Output is partially correct - L* = 18
24 Partially correct 55 ms 4064 KB Output is partially correct - L* = 17
25 Partially correct 67 ms 4064 KB Output is partially correct - L* = 21
26 Partially correct 53 ms 4064 KB Output is partially correct - L* = 16
27 Partially correct 72 ms 4064 KB Output is partially correct - L* = 15
28 Partially correct 63 ms 4064 KB Output is partially correct - L* = 16
29 Partially correct 59 ms 4064 KB Output is partially correct - L* = 16
30 Partially correct 46 ms 4064 KB Output is partially correct - L* = 21
31 Partially correct 46 ms 4064 KB Output is partially correct - L* = 16
32 Partially correct 63 ms 4064 KB Output is partially correct - L* = 18
33 Partially correct 57 ms 4064 KB Output is partially correct - L* = 17
34 Partially correct 54 ms 4064 KB Output is partially correct - L* = 18
35 Partially correct 48 ms 4064 KB Output is partially correct - L* = 15
36 Partially correct 46 ms 4064 KB Output is partially correct - L* = 20
37 Partially correct 69 ms 4064 KB Output is partially correct - L* = 16
38 Partially correct 50 ms 4064 KB Output is partially correct - L* = 18
39 Partially correct 43 ms 4064 KB Output is partially correct - L* = 17
40 Partially correct 47 ms 4064 KB Output is partially correct - L* = 15