답안 #101877

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
101877 2019-03-20T16:04:04 Z hugo_pm Broken Device (JOI17_broken_device) C++17
43 / 100
70 ms 3160 KB
#include "Annalib.h"

typedef long long llg;
const int borne = 155;
int lenSeq, nbCas;
bool bloque[borne];
int ret[borne];
int k[borne] {0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0};
long long nombre;


void solve()
{
	ret[0] = 1;
	int lst = 0;
	int i = 1;
	for (int b = 59; b >= 0; --b) {
		int c = 0;
		if (nombre & (1LL << (long long)(b))) c = 1;

		while (i+1 < lenSeq && (k[i - lst] != c || bloque[i])) ++i;

		if (i >= lenSeq) return;
		ret[i] = 1;
		lst = i;
		i++;
	}
}

void Anna( int N, long long X, int K, int P[] ){
	lenSeq = N;
	nombre = X;

	for (int i = 0; i < N; ++i) { bloque[i] = false; ret[i] = 0; }
	for (int i = 0; i < K; ++i) bloque[P[i]] = true;
	solve();
	for (int i = 0; i < N; ++i) Set(i, ret[i]);
	return;
}
#include "Brunolib.h"

int k2[155] {0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0};

long long Bruno( int N, int A[] ){
	long long X = 0;
	int lst = 0, i = 1;
	for (int b = 59; b >= 0; --b) {
		while (A[i] == 0) ++i;
		if (k2[i - lst] == 1) X += 1LL << (long long)(b);
		lst = i;
		++i;
	}
	return X;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 35 ms 2800 KB Output is partially correct - L* = 25
2 Partially correct 50 ms 3056 KB Output is partially correct - L* = 22
3 Partially correct 39 ms 3056 KB Output is partially correct - L* = 16
4 Partially correct 39 ms 2936 KB Output is partially correct - L* = 26
5 Partially correct 59 ms 2888 KB Output is partially correct - L* = 26
6 Partially correct 47 ms 2968 KB Output is partially correct - L* = 21
7 Partially correct 55 ms 2816 KB Output is partially correct - L* = 19
8 Partially correct 60 ms 2800 KB Output is partially correct - L* = 16
9 Partially correct 36 ms 2944 KB Output is partially correct - L* = 28
10 Partially correct 43 ms 3016 KB Output is partially correct - L* = 27
11 Partially correct 40 ms 3056 KB Output is partially correct - L* = 19
12 Partially correct 46 ms 2800 KB Output is partially correct - L* = 21
13 Partially correct 54 ms 2800 KB Output is partially correct - L* = 21
14 Partially correct 39 ms 3064 KB Output is partially correct - L* = 26
15 Partially correct 40 ms 3032 KB Output is partially correct - L* = 26
16 Partially correct 55 ms 2816 KB Output is partially correct - L* = 17
17 Partially correct 51 ms 3160 KB Output is partially correct - L* = 22
18 Partially correct 49 ms 2800 KB Output is partially correct - L* = 23
19 Partially correct 36 ms 2816 KB Output is partially correct - L* = 23
20 Partially correct 45 ms 3016 KB Output is partially correct - L* = 23
21 Partially correct 40 ms 3016 KB Output is partially correct - L* = 30
22 Partially correct 70 ms 3056 KB Output is partially correct - L* = 33
23 Partially correct 59 ms 3056 KB Output is partially correct - L* = 27
24 Partially correct 45 ms 2816 KB Output is partially correct - L* = 28
25 Partially correct 44 ms 2816 KB Output is partially correct - L* = 29
26 Partially correct 44 ms 3056 KB Output is partially correct - L* = 29
27 Partially correct 46 ms 2816 KB Output is partially correct - L* = 31
28 Partially correct 45 ms 2816 KB Output is partially correct - L* = 29
29 Partially correct 39 ms 2800 KB Output is partially correct - L* = 26
30 Partially correct 62 ms 3064 KB Output is partially correct - L* = 26
31 Partially correct 46 ms 3072 KB Output is partially correct - L* = 29
32 Partially correct 48 ms 2816 KB Output is partially correct - L* = 20
33 Partially correct 50 ms 3056 KB Output is partially correct - L* = 17
34 Partially correct 52 ms 2816 KB Output is partially correct - L* = 28
35 Partially correct 39 ms 2816 KB Output is partially correct - L* = 30
36 Partially correct 39 ms 2952 KB Output is partially correct - L* = 22
37 Partially correct 45 ms 2816 KB Output is partially correct - L* = 20
38 Partially correct 41 ms 2816 KB Output is partially correct - L* = 25
39 Partially correct 40 ms 3072 KB Output is partially correct - L* = 26
40 Partially correct 45 ms 2816 KB Output is partially correct - L* = 25