Submission #101871

# Submission time Handle Problem Language Result Execution time Memory
101871 2019-03-20T15:35:10 Z hugo_pm Broken Device (JOI17_broken_device) C++17
0 / 100
62 ms 3208 KB
#include "Annalib.h"
#include <cassert>

typedef long long llg;
const int borne = 155;
int lenSeq, nbCas;
bool bloque[borne];
int ret[borne];
long long nombre;


void solve()
{
	long long p3 = 1; for (int b = 1; b <= 38; ++b) p3 *= 3LL;
	int i = 0;
	for (int b = 38; b >= 0; --b) {
		int c = nombre/p3;
		nombre %= p3;
		p3 /= 3LL;
		assert(0 <= c && c <= 2);

		int cg = 0, cd = 1;
		if (c == 1) { cg = 1; cd = 0; }
		if (c == 2) { cg = 1; cd = 1; }
		while ((bloque[i] && cg) || (bloque[i+1] && cd)) ++i;
		if (i+1 >= lenSeq) return;

		ret[i] = cg;
		ret[i+1] = cd;
		i += 2;
	}
}

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"

long long Bruno( int N, int A[] ){
	long long X = 0;
	int i = 0;
	long long p3 = 1; for (int i = 1; i <= 38; ++i) p3 *= 3LL;
	for (int b = 38; b >= 0; --b) {
		while (A[i] == 0 && A[i+1] == 0) ++i;
		int cg = A[i], cd = A[i+1];
		int c = 0;
		if (cg == 1) {
			if (cd == 0) c = 1;
			else c = 2;
		}
		X += (long long)(c) * p3;
		i += 2;
		p3 /= 3LL;
	}
	return X;
}
# Verdict Execution time Memory Grader output
1 Incorrect 62 ms 3056 KB Output isn't correct - L* = 0
2 Incorrect 56 ms 2800 KB Output isn't correct - L* = 0
3 Incorrect 40 ms 3064 KB Output isn't correct - L* = 0
4 Incorrect 38 ms 2816 KB Output isn't correct - L* = 0
5 Incorrect 52 ms 2816 KB Output isn't correct - L* = 0
6 Incorrect 40 ms 2808 KB Output isn't correct - L* = 0
7 Incorrect 45 ms 3072 KB Output isn't correct - L* = 0
8 Incorrect 37 ms 3072 KB Output isn't correct - L* = 0
9 Incorrect 39 ms 2816 KB Output isn't correct - L* = 0
10 Incorrect 41 ms 3072 KB Output isn't correct - L* = 0
11 Incorrect 44 ms 3056 KB Output isn't correct - L* = 0
12 Incorrect 41 ms 2984 KB Output isn't correct - L* = 0
13 Incorrect 41 ms 3072 KB Output isn't correct - L* = 0
14 Incorrect 50 ms 2816 KB Output isn't correct - L* = 0
15 Incorrect 39 ms 2992 KB Output isn't correct - L* = 0
16 Incorrect 37 ms 2816 KB Output isn't correct - L* = 0
17 Incorrect 47 ms 3072 KB Output isn't correct - L* = 0
18 Incorrect 54 ms 2936 KB Output isn't correct - L* = 0
19 Incorrect 45 ms 2816 KB Output isn't correct - L* = 0
20 Incorrect 39 ms 3056 KB Output isn't correct - L* = 0
21 Incorrect 36 ms 2800 KB Output isn't correct - L* = 0
22 Incorrect 37 ms 2816 KB Output isn't correct - L* = 0
23 Incorrect 36 ms 3072 KB Output isn't correct - L* = 0
24 Incorrect 37 ms 3072 KB Output isn't correct - L* = 0
25 Incorrect 40 ms 3208 KB Output isn't correct - L* = 0
26 Incorrect 51 ms 3072 KB Output isn't correct - L* = 0
27 Incorrect 47 ms 3056 KB Output isn't correct - L* = 0
28 Incorrect 40 ms 3056 KB Output isn't correct - L* = 0
29 Incorrect 40 ms 2800 KB Output isn't correct - L* = 0
30 Incorrect 53 ms 2800 KB Output isn't correct - L* = 0
31 Incorrect 47 ms 3072 KB Output isn't correct - L* = 0
32 Incorrect 44 ms 2816 KB Output isn't correct - L* = 0
33 Incorrect 37 ms 2912 KB Output isn't correct - L* = 0
34 Incorrect 55 ms 3032 KB Output isn't correct - L* = 0
35 Incorrect 50 ms 3056 KB Output isn't correct - L* = 0
36 Incorrect 62 ms 2808 KB Output isn't correct - L* = 0
37 Incorrect 52 ms 3056 KB Output isn't correct - L* = 0
38 Incorrect 38 ms 2800 KB Output isn't correct - L* = 0
39 Incorrect 53 ms 2800 KB Output isn't correct - L* = 0
40 Incorrect 44 ms 3056 KB Output isn't correct - L* = 0