#include "Annalib.h"
#include "bits/stdc++.h"
using namespace std;
static mt19937_64 rng((long long) std::chrono::steady_clock::now().time_since_epoch().count());
static long long rnd(long long x, long long y) {
return uniform_int_distribution<long long>(x, y)(rng);
}
const static long long R = 487846703374293674ll;
const static int S[150] = {
111, 107, 40, 99, 11, 30, 35, 87, 58, 71, 64, 93, 70,
54, 55, 106, 117, 12, 133, 26, 7, 120, 60, 103, 138, 130,
9, 116, 89, 122, 37, 43, 23, 125, 105, 98, 46, 42, 145,
27, 59, 15, 92, 96, 10, 5, 121, 38, 18, 95, 143, 140,
72, 129, 101, 22, 16, 61, 109, 88, 63, 85, 66, 135, 36,
68, 81, 83, 132, 51, 65, 78, 73, 2, 32, 74, 86, 50, 69,
6, 14, 100, 52, 114, 53, 136, 102, 3, 84, 21, 149, 113,
127, 76, 134, 77, 94, 48, 128, 0, 67, 75, 80, 104, 33, 112,
39, 124, 131, 1, 90, 123, 8, 82, 119, 126, 139, 29, 34,
144, 57, 49, 115, 146, 28, 4, 62, 24, 19, 45, 118, 141,
79, 44, 47, 20, 137, 41, 147, 25, 56, 17, 91, 13, 108,
142, 31, 97, 148, 110
};
void Anna( int N, long long X, int K, int P[] ){
X ^= R;
bool bad[N];
for(int i=0; i<N; i++) bad[i] = 0;
for(int i=0; i<K; i++) bad[P[i]] = 1;
int bit = 59;
for(int i=0; i<N; i++) {
int cur = S[i];
if(i+1 == N) { // can't do anything
Set(cur, 0); break;
}
int nxt = S[i+1];
if(bad[cur] == 1) {
Set(cur, 0); continue;
}
if(bit == -1) {
Set(cur, 0); continue;
}
// Current can transmit info
if(bad[nxt] == 0 || (X & (1ll << bit)) == 0) {
Set(cur, 1);
//cout << cur << " is set to 1, " << nxt << "\n";
long long res = X & (1ll << bit);
if(res > 0) res = 1;
Set(nxt, res);
i++;
bit--;
}
else {
Set(cur, 0);
}
}
//cout << bit << "\n";
}
#include "Brunolib.h"
#include "bits/stdc++.h"
using namespace std;
static mt19937_64 rng((long long) std::chrono::steady_clock::now().time_since_epoch().count());
static long long rnd(long long x, long long y) {
return uniform_int_distribution<long long>(x, y)(rng);
}
const static long long R = 487846703374293674ll;
const static int S[150] = {
111, 107, 40, 99, 11, 30, 35, 87, 58, 71, 64, 93, 70,
54, 55, 106, 117, 12, 133, 26, 7, 120, 60, 103, 138, 130,
9, 116, 89, 122, 37, 43, 23, 125, 105, 98, 46, 42, 145,
27, 59, 15, 92, 96, 10, 5, 121, 38, 18, 95, 143, 140,
72, 129, 101, 22, 16, 61, 109, 88, 63, 85, 66, 135, 36,
68, 81, 83, 132, 51, 65, 78, 73, 2, 32, 74, 86, 50, 69,
6, 14, 100, 52, 114, 53, 136, 102, 3, 84, 21, 149, 113,
127, 76, 134, 77, 94, 48, 128, 0, 67, 75, 80, 104, 33, 112,
39, 124, 131, 1, 90, 123, 8, 82, 119, 126, 139, 29, 34,
144, 57, 49, 115, 146, 28, 4, 62, 24, 19, 45, 118, 141,
79, 44, 47, 20, 137, 41, 147, 25, 56, 17, 91, 13, 108,
142, 31, 97, 148, 110
};
long long Bruno( int N, int A[] ){
long long X = 0;
int bit = 59;
for(int i=0; i<N; i++) {
// cout << "checking " << S[i] << ": A["<<S[i]<<"] = " << A[S[i]] << "\n";
if(A[S[i]] == 1) {
// cout << "A[" << S[i]<<"] = 1\n";
if(A[S[i+1]]) X ^= (1ll << bit);
i++;
bit--;
if(bit == -1) break;
}
}
return X ^ R;
}
Compilation message
Anna.cpp:8:18: warning: 'long long int rnd(long long int, long long int)' defined but not used [-Wunused-function]
8 | static long long rnd(long long x, long long y) {
| ^~~
Bruno.cpp:8:18: warning: 'long long int rnd(long long int, long long int)' defined but not used [-Wunused-function]
8 | static long long rnd(long long x, long long y) {
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
30 ms |
2604 KB |
Output is partially correct - L* = 22 |
2 |
Partially correct |
31 ms |
2468 KB |
Output is partially correct - L* = 22 |
3 |
Partially correct |
35 ms |
2460 KB |
Output is partially correct - L* = 22 |
4 |
Partially correct |
31 ms |
2584 KB |
Output is partially correct - L* = 24 |
5 |
Partially correct |
30 ms |
2672 KB |
Output is partially correct - L* = 22 |
6 |
Partially correct |
40 ms |
2628 KB |
Output is partially correct - L* = 24 |
7 |
Partially correct |
31 ms |
2544 KB |
Output is partially correct - L* = 25 |
8 |
Partially correct |
32 ms |
2580 KB |
Output is partially correct - L* = 24 |
9 |
Partially correct |
33 ms |
2528 KB |
Output is partially correct - L* = 21 |
10 |
Partially correct |
38 ms |
2500 KB |
Output is partially correct - L* = 21 |
11 |
Partially correct |
30 ms |
2576 KB |
Output is partially correct - L* = 23 |
12 |
Partially correct |
33 ms |
2472 KB |
Output is partially correct - L* = 22 |
13 |
Partially correct |
32 ms |
2568 KB |
Output is partially correct - L* = 24 |
14 |
Partially correct |
30 ms |
2480 KB |
Output is partially correct - L* = 24 |
15 |
Partially correct |
31 ms |
2504 KB |
Output is partially correct - L* = 25 |
16 |
Partially correct |
32 ms |
2468 KB |
Output is partially correct - L* = 21 |
17 |
Partially correct |
38 ms |
2408 KB |
Output is partially correct - L* = 24 |
18 |
Partially correct |
31 ms |
2612 KB |
Output is partially correct - L* = 21 |
19 |
Partially correct |
31 ms |
2612 KB |
Output is partially correct - L* = 23 |
20 |
Partially correct |
35 ms |
2436 KB |
Output is partially correct - L* = 23 |
21 |
Partially correct |
34 ms |
2484 KB |
Output is partially correct - L* = 24 |
22 |
Partially correct |
32 ms |
2476 KB |
Output is partially correct - L* = 25 |
23 |
Partially correct |
33 ms |
2456 KB |
Output is partially correct - L* = 22 |
24 |
Partially correct |
35 ms |
2484 KB |
Output is partially correct - L* = 24 |
25 |
Partially correct |
33 ms |
2564 KB |
Output is partially correct - L* = 24 |
26 |
Partially correct |
37 ms |
2580 KB |
Output is partially correct - L* = 25 |
27 |
Partially correct |
32 ms |
2484 KB |
Output is partially correct - L* = 20 |
28 |
Partially correct |
32 ms |
2516 KB |
Output is partially correct - L* = 23 |
29 |
Partially correct |
33 ms |
2508 KB |
Output is partially correct - L* = 22 |
30 |
Partially correct |
38 ms |
2600 KB |
Output is partially correct - L* = 24 |
31 |
Partially correct |
31 ms |
2544 KB |
Output is partially correct - L* = 26 |
32 |
Partially correct |
33 ms |
2608 KB |
Output is partially correct - L* = 23 |
33 |
Partially correct |
34 ms |
2612 KB |
Output is partially correct - L* = 24 |
34 |
Partially correct |
33 ms |
2524 KB |
Output is partially correct - L* = 25 |
35 |
Partially correct |
37 ms |
2532 KB |
Output is partially correct - L* = 25 |
36 |
Partially correct |
43 ms |
2548 KB |
Output is partially correct - L* = 25 |
37 |
Partially correct |
30 ms |
2492 KB |
Output is partially correct - L* = 24 |
38 |
Partially correct |
30 ms |
2616 KB |
Output is partially correct - L* = 22 |
39 |
Partially correct |
37 ms |
2436 KB |
Output is partially correct - L* = 24 |
40 |
Partially correct |
31 ms |
2464 KB |
Output is partially correct - L* = 23 |