#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pi;
typedef long long ll;
#define MAX 153
int res[MAX];
bool chkb[MAX];
int arr[MAX];
int ptr;
void print(int i) {
int a, b, c;
a = 3 * i;
b = a + 1;
c = a + 2;
int rs = chkb[a] + chkb[b] + chkb[c];
if (rs >= 2) return;
vector<int> tx;
if (rs == 0) {
int x = arr[ptr] * 2 + arr[ptr + 1];
ptr += 2;
if (x == 0) tx = { 0, 1, 1 };
if (x == 1) tx = { 0, 0, 1 };
if (x == 2) tx = { 1, 1, 0 };
if (x == 3) tx = { 1, 1, 1 };
}
else {
if (chkb[a]) {
if (arr[ptr]) tx = { 0, 1, 0 }, ptr++;
else {
if (arr[ptr + 1]) tx = { 0, 0, 1 };
else tx = { 0, 1, 1 };
ptr += 2;
}
}
else {
if (arr[ptr]) tx = chkb[b] ? (vector<int>{ 1, 0, 1 }) : vector<int>{ 0, 1, 0 };
else tx = { 1, 0, 0 };
ptr += 1;
}
}
tie(res[a], res[b], res[c]) = tie(tx[0], tx[1], tx[2]);
}
void Anna(int N, long long X, int K, int P[]) {
memset(res, 0, sizeof(res));
memset(arr, 0, sizeof(arr));
memset(chkb, 0, sizeof(chkb));
ptr = 0;
int i;
for (i = 0; i < 60; i++) if (X & (1LL << (ll)(59 - i))) arr[i] = 1;
for (i = 0; i < K; i++) chkb[P[i]] = true;
for (i = 0; i < 50; i++) print(i);
for (i = 0; i < 150; i++) Set(i, res[i]);
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<vector<int>> vv = { {}, {0, 1}, {1}, {0, 0}, {0}, {1}, {1, 0}, {1, 1} };
int get(int a, int b, int c) {
return a * 4 + b * 2 + c;
}
long long Bruno( int N, int A[] ){
ll res = 0;
int i;
int a, b, c;
a = 0;
b = 1;
c = 2;
vector<int> bits;
for (i = 0; i < 50; i++) {
int x = get(A[a], A[b], A[c]);
bits.insert(bits.end(), vv[x].begin(), vv[x].end());
a += 3;
b += 3;
c += 3;
}
for (i = 0; i < 60; i++) if (bits[i]) res += 1LL << (ll)(59 - i);
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
2476 KB |
Output is correct - L* = 40 |
2 |
Correct |
31 ms |
2612 KB |
Output is correct - L* = 40 |
3 |
Correct |
31 ms |
2560 KB |
Output is correct - L* = 40 |
4 |
Correct |
31 ms |
2608 KB |
Output is correct - L* = 40 |
5 |
Correct |
38 ms |
2556 KB |
Output is correct - L* = 40 |
6 |
Correct |
32 ms |
2568 KB |
Output is correct - L* = 40 |
7 |
Correct |
31 ms |
2492 KB |
Output is correct - L* = 40 |
8 |
Correct |
30 ms |
2632 KB |
Output is correct - L* = 40 |
9 |
Correct |
28 ms |
2508 KB |
Output is correct - L* = 40 |
10 |
Correct |
32 ms |
2684 KB |
Output is correct - L* = 40 |
11 |
Correct |
38 ms |
2460 KB |
Output is correct - L* = 40 |
12 |
Correct |
39 ms |
2572 KB |
Output is correct - L* = 40 |
13 |
Correct |
31 ms |
2612 KB |
Output is correct - L* = 40 |
14 |
Correct |
30 ms |
2508 KB |
Output is correct - L* = 40 |
15 |
Correct |
31 ms |
2488 KB |
Output is correct - L* = 40 |
16 |
Correct |
30 ms |
2728 KB |
Output is correct - L* = 40 |
17 |
Correct |
30 ms |
2596 KB |
Output is correct - L* = 40 |
18 |
Correct |
33 ms |
2628 KB |
Output is correct - L* = 40 |
19 |
Correct |
46 ms |
2604 KB |
Output is correct - L* = 40 |
20 |
Correct |
31 ms |
2668 KB |
Output is correct - L* = 40 |
21 |
Correct |
32 ms |
2636 KB |
Output is correct - L* = 40 |
22 |
Correct |
32 ms |
2600 KB |
Output is correct - L* = 40 |
23 |
Correct |
31 ms |
2660 KB |
Output is correct - L* = 40 |
24 |
Correct |
37 ms |
2584 KB |
Output is correct - L* = 40 |
25 |
Correct |
33 ms |
2708 KB |
Output is correct - L* = 40 |
26 |
Correct |
31 ms |
2484 KB |
Output is correct - L* = 40 |
27 |
Correct |
31 ms |
2620 KB |
Output is correct - L* = 40 |
28 |
Correct |
30 ms |
2612 KB |
Output is correct - L* = 40 |
29 |
Correct |
32 ms |
2692 KB |
Output is correct - L* = 40 |
30 |
Correct |
33 ms |
2612 KB |
Output is correct - L* = 40 |
31 |
Correct |
32 ms |
2680 KB |
Output is correct - L* = 40 |
32 |
Correct |
31 ms |
2668 KB |
Output is correct - L* = 40 |
33 |
Correct |
30 ms |
2484 KB |
Output is correct - L* = 40 |
34 |
Correct |
32 ms |
2532 KB |
Output is correct - L* = 40 |
35 |
Correct |
34 ms |
2632 KB |
Output is correct - L* = 40 |
36 |
Correct |
39 ms |
2548 KB |
Output is correct - L* = 40 |
37 |
Correct |
45 ms |
2612 KB |
Output is correct - L* = 40 |
38 |
Correct |
32 ms |
2576 KB |
Output is correct - L* = 40 |
39 |
Correct |
31 ms |
2480 KB |
Output is correct - L* = 40 |
40 |
Correct |
30 ms |
2584 KB |
Output is correct - L* = 40 |