// chrono::system_clock::now().time_since_epoch().count()
#include "Annalib.h"
#include<bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << " = " << x << endl;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
namespace {
int seed[] = {136, 241, 13, 4, 59};
int n, k, bad_pos[45];
int is_bad[205];
int perm[205];
ll msg;
int bit(ll x, int p) {
if (p > 60) return 0;
return (x >> p) & 1;
}
void set(int p, int x) {
if (p < n) {
Set(p, x);
}
}
void solve() {
fill(is_bad, is_bad + n, 0);
for (int i = 0; i < k; ++i) {
is_bad[bad_pos[i]] = 1;
}
for (int i = 0; i < n; ++i) {
perm[i] = i;
}
mt19937 rnd(seed[0]);
for (int i = 1; i < n; ++i) {
swap(perm[i], perm[rnd() % i]);
}
int p = 0;
for (int i = 0; i < n; i += 2) {
if (is_bad[perm[i]] || is_bad[perm[i + 1]]) {
set(perm[i], 0);
set(perm[i + 1], 0);
}
else {
set(perm[i], 1);
set(perm[i + 1], bit(msg, p++));
}
}
}
};
void Anna( int N, long long X, int K, int P[] ){
n = N;
msg = X;
k = K;
for (int i = 0; i < k; ++i) {
bad_pos[i] = P[i];
}
solve();
}
// chrono::system_clock::now().time_since_epoch().count()
#include "Brunolib.h"
#include<bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << " = " << x << endl;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
namespace {
int seed[] = {136, 241, 13, 4, 59};
int n, arr[205], perm[205];
ll solve() {
ll ret = 0;
for (int i = 0; i < n; ++i) {
perm[i] = i;
}
mt19937 rnd(perm[0]);
for (int i = 1; i < n; ++i) {
swap(perm[i], perm[rnd() % i]);
}
int p = 0;
for (int i = 0; i < n; i += 2) {
if (arr[perm[i]] == 0) {
continue;
}
if (arr[perm[i + 1]]) {
ret += (1ll << p);
}
p++;
}
return ret;
}
};
long long Bruno( int N, int A[] ){
n = N;
for (int i = 0; i < n; ++i) {
arr[i] = A[i];
}
return solve();
}
Compilation message
Bruno.cpp:19:7: warning: '{anonymous}::seed' defined but not used [-Wunused-variable]
19 | int seed[] = {136, 241, 13, 4, 59};
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
59 ms |
3312 KB |
Output isn't correct - L* = 0 |
2 |
Partially correct |
62 ms |
3312 KB |
Output isn't correct - L* = 0 |
3 |
Partially correct |
59 ms |
3312 KB |
Output isn't correct - L* = 0 |
4 |
Partially correct |
57 ms |
3312 KB |
Output isn't correct - L* = 0 |
5 |
Partially correct |
60 ms |
3312 KB |
Output isn't correct - L* = 0 |
6 |
Partially correct |
60 ms |
3320 KB |
Output isn't correct - L* = 0 |
7 |
Partially correct |
57 ms |
3312 KB |
Output isn't correct - L* = 0 |
8 |
Partially correct |
59 ms |
3312 KB |
Output isn't correct - L* = 0 |
9 |
Partially correct |
61 ms |
3312 KB |
Output isn't correct - L* = 0 |
10 |
Partially correct |
61 ms |
3312 KB |
Output isn't correct - L* = 0 |
11 |
Partially correct |
59 ms |
3312 KB |
Output isn't correct - L* = 0 |
12 |
Partially correct |
59 ms |
3312 KB |
Output isn't correct - L* = 0 |
13 |
Partially correct |
59 ms |
3328 KB |
Output isn't correct - L* = 0 |
14 |
Partially correct |
59 ms |
3280 KB |
Output isn't correct - L* = 0 |
15 |
Partially correct |
62 ms |
3312 KB |
Output isn't correct - L* = 0 |
16 |
Partially correct |
59 ms |
3328 KB |
Output isn't correct - L* = 0 |
17 |
Partially correct |
59 ms |
3328 KB |
Output isn't correct - L* = 0 |
18 |
Partially correct |
60 ms |
3312 KB |
Output isn't correct - L* = 0 |
19 |
Partially correct |
59 ms |
3312 KB |
Output isn't correct - L* = 0 |
20 |
Partially correct |
60 ms |
3312 KB |
Output isn't correct - L* = 0 |
21 |
Partially correct |
60 ms |
3312 KB |
Output isn't correct - L* = 0 |
22 |
Partially correct |
60 ms |
3328 KB |
Output isn't correct - L* = 0 |
23 |
Partially correct |
59 ms |
3312 KB |
Output isn't correct - L* = 0 |
24 |
Partially correct |
60 ms |
3312 KB |
Output isn't correct - L* = 0 |
25 |
Partially correct |
60 ms |
3312 KB |
Output isn't correct - L* = 0 |
26 |
Partially correct |
60 ms |
3320 KB |
Output isn't correct - L* = 0 |
27 |
Partially correct |
59 ms |
3312 KB |
Output isn't correct - L* = 0 |
28 |
Partially correct |
59 ms |
3312 KB |
Output isn't correct - L* = 0 |
29 |
Partially correct |
59 ms |
3312 KB |
Output isn't correct - L* = 0 |
30 |
Partially correct |
62 ms |
3312 KB |
Output isn't correct - L* = 0 |
31 |
Partially correct |
59 ms |
3320 KB |
Output isn't correct - L* = 0 |
32 |
Partially correct |
59 ms |
3328 KB |
Output isn't correct - L* = 0 |
33 |
Partially correct |
59 ms |
3312 KB |
Output isn't correct - L* = 0 |
34 |
Partially correct |
60 ms |
3328 KB |
Output isn't correct - L* = 0 |
35 |
Partially correct |
59 ms |
3312 KB |
Output isn't correct - L* = 0 |
36 |
Partially correct |
57 ms |
3320 KB |
Output isn't correct - L* = 0 |
37 |
Partially correct |
59 ms |
3312 KB |
Output isn't correct - L* = 0 |
38 |
Partially correct |
57 ms |
3312 KB |
Output isn't correct - L* = 0 |
39 |
Partially correct |
60 ms |
3328 KB |
Output isn't correct - L* = 0 |
40 |
Partially correct |
60 ms |
3312 KB |
Output isn't correct - L* = 0 |