#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;
bool solve(int x)
{
int i = 0;
while (bloque[i] || k[i] != x) ++i;
ret[i] = 1;
++i;
for (int b = 59; b >= 0; --b) {
int c = 0;
if (nombre & (1LL << (long long)(b))) c = 1;
if (x) c = 1-c;
while (bloque[i] || (bloque[i+1] && c)) ++i;
if (i+1 >= lenSeq) return false;
ret[i] = 1;
ret[i+1] = c;
i += 2;
}
return true;
}
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;
if (! solve(0)) {
for (int i = 0; i < N; ++i) ret[i] = 0;
solve(1);
}
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 i = 0;
while (A[i] == 0) ++i;
int rq = 1 - k2[i];
++i;
for (int b = 59; b >= 0; --b) {
while (A[i] == 0) ++i;
++i;
if (A[i] == rq) X += 1LL << (long long)(b);
++i;
}
return X;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
46 ms |
3056 KB |
Output is partially correct - L* = 15 |
2 |
Partially correct |
47 ms |
3144 KB |
Output is partially correct - L* = 15 |
3 |
Partially correct |
46 ms |
3056 KB |
Output is partially correct - L* = 19 |
4 |
Partially correct |
49 ms |
3072 KB |
Output is partially correct - L* = 16 |
5 |
Partially correct |
61 ms |
3056 KB |
Output is partially correct - L* = 17 |
6 |
Partially correct |
49 ms |
3072 KB |
Output is partially correct - L* = 15 |
7 |
Partially correct |
39 ms |
3072 KB |
Output is partially correct - L* = 18 |
8 |
Partially correct |
44 ms |
3312 KB |
Output is partially correct - L* = 15 |
9 |
Partially correct |
60 ms |
3072 KB |
Output is partially correct - L* = 18 |
10 |
Partially correct |
47 ms |
3152 KB |
Output is partially correct - L* = 16 |
11 |
Partially correct |
43 ms |
3056 KB |
Output is partially correct - L* = 19 |
12 |
Partially correct |
40 ms |
3072 KB |
Output is partially correct - L* = 16 |
13 |
Partially correct |
40 ms |
3056 KB |
Output is partially correct - L* = 18 |
14 |
Partially correct |
39 ms |
3056 KB |
Output is partially correct - L* = 15 |
15 |
Partially correct |
45 ms |
3072 KB |
Output is partially correct - L* = 16 |
16 |
Partially correct |
43 ms |
3072 KB |
Output is partially correct - L* = 19 |
17 |
Partially correct |
53 ms |
3056 KB |
Output is partially correct - L* = 22 |
18 |
Partially correct |
50 ms |
3056 KB |
Output is partially correct - L* = 16 |
19 |
Partially correct |
41 ms |
3072 KB |
Output is partially correct - L* = 18 |
20 |
Partially correct |
48 ms |
2960 KB |
Output is partially correct - L* = 18 |
21 |
Partially correct |
40 ms |
3056 KB |
Output is partially correct - L* = 14 |
22 |
Partially correct |
53 ms |
3016 KB |
Output is partially correct - L* = 16 |
23 |
Partially correct |
41 ms |
3072 KB |
Output is partially correct - L* = 17 |
24 |
Partially correct |
46 ms |
3056 KB |
Output is partially correct - L* = 17 |
25 |
Partially correct |
53 ms |
3072 KB |
Output is partially correct - L* = 14 |
26 |
Partially correct |
47 ms |
3056 KB |
Output is partially correct - L* = 16 |
27 |
Partially correct |
61 ms |
3056 KB |
Output is partially correct - L* = 16 |
28 |
Partially correct |
47 ms |
3056 KB |
Output is partially correct - L* = 15 |
29 |
Partially correct |
48 ms |
3056 KB |
Output is partially correct - L* = 16 |
30 |
Partially correct |
58 ms |
3056 KB |
Output is partially correct - L* = 22 |
31 |
Partially correct |
45 ms |
3328 KB |
Output is partially correct - L* = 17 |
32 |
Partially correct |
43 ms |
3056 KB |
Output is partially correct - L* = 18 |
33 |
Partially correct |
55 ms |
3056 KB |
Output is partially correct - L* = 15 |
34 |
Partially correct |
55 ms |
3072 KB |
Output is partially correct - L* = 14 |
35 |
Partially correct |
48 ms |
3064 KB |
Output is partially correct - L* = 15 |
36 |
Partially correct |
39 ms |
3072 KB |
Output is partially correct - L* = 15 |
37 |
Partially correct |
38 ms |
3016 KB |
Output is partially correct - L* = 18 |
38 |
Partially correct |
43 ms |
3056 KB |
Output is partially correct - L* = 18 |
39 |
Partially correct |
61 ms |
3056 KB |
Output is partially correct - L* = 17 |
40 |
Partially correct |
50 ms |
3056 KB |
Output is partially correct - L* = 15 |