#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(ll i = (ll)a; i <= (ll)b; i++)
#define DEC(i, a, b) for(ll i = (ll)a; i >= (ll)b; i--)
typedef pair<ll, ll> pi;
#define f first
#define s second
typedef vector<ll> vi;
typedef vector<pi> vpi;
#define pb push_back
#define all(v) v.begin(), v.end()
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
bool res[155], no[155];
int num[55], x, val[65];
void up(ll x, ll a, ll b, ll c) {
res[3*x] = a;
res[3*x+1] = b;
res[3*x+2] = c;
}
void Anna(int n, long long X, int k, int p[]){
memset(res, 0, sizeof res); memset(no, 0, sizeof no);
memset(num, 0, sizeof num); memset(val, 0, sizeof val);
x = 0;
FOR(i, 0, 59) {
val[i] = X % 2;
X /= 2;
}
FOR(i, 0, k-1) {
no[p[i]] = 1;
num[p[i]/3]++;
}
FOR(i, 0, n/3-1) {
if (x >= 60) break;
if (num[i] == 0) {
ll t = 2*val[x] + val[x+1];
if (t == 0) up(i, 1, 0, 0);
else if (t == 1) up(i, 1, 0, 1);
else if (t == 2) up(i, 0, 1, 1);
else up(i, 1, 1, 1);
x += 2;
} else if (num[i] == 1) {
if (no[3*i]) {
if (val[x] == 0) up(i, 0, 1, 0);
else up(i, 0, 0, 1);
x++;
} else if (no[3*i+1]) {
if (val[x] == 1) { //1
up(i, 0, 0, 1);
x++;
} else if (val[x+1] == 0) { //00
up(i, 1, 0, 0);
x += 2;
} else if (val[x+1] == 1) { //01
up(i, 1, 0, 1);
x += 2;
}
} else {
if (val[x] == 0) up(i, 0, 1, 0);
else up(i, 1, 1, 0);
x++;
}
}
}
FOR(i, 0, n-1) Set(i, res[i]);
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(ll i = (ll)a; i <= (ll)b; i++)
#define DEC(i, a, b) for(ll i = (ll)a; i >= (ll)b; i--)
typedef pair<ll, ll> pi;
#define f first
#define s second
typedef vector<ll> vi;
typedef vector<pi> vpi;
#define pb push_back
#define all(v) v.begin(), v.end()
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
string ans;
ll v;
string tos[] = {"", "1", "0", "10", "00", "01", "1", "11"};
long long Bruno(int n, int arr[] ){
ans = ""; v = 0ll;
FOR(i, 0, n/3-1) {
int t = 4*arr[3*i] + 2*arr[3*i+1] + arr[3*i+2];
if (t == 0) continue;
ans += tos[t];
}
FOR(i, 0, ans.length()-1) {
if (ans[i] == '1') v += ((ll) (1ll<<i));
}
return v;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
50 ms |
3056 KB |
Output is correct - L* = 40 |
2 |
Correct |
49 ms |
3072 KB |
Output is correct - L* = 40 |
3 |
Correct |
49 ms |
3072 KB |
Output is correct - L* = 40 |
4 |
Correct |
52 ms |
3072 KB |
Output is correct - L* = 40 |
5 |
Correct |
49 ms |
3072 KB |
Output is correct - L* = 40 |
6 |
Correct |
49 ms |
3056 KB |
Output is correct - L* = 40 |
7 |
Correct |
50 ms |
3072 KB |
Output is correct - L* = 40 |
8 |
Correct |
49 ms |
3072 KB |
Output is correct - L* = 40 |
9 |
Correct |
49 ms |
3072 KB |
Output is correct - L* = 40 |
10 |
Correct |
50 ms |
3056 KB |
Output is correct - L* = 40 |
11 |
Correct |
51 ms |
3056 KB |
Output is correct - L* = 40 |
12 |
Correct |
51 ms |
3056 KB |
Output is correct - L* = 40 |
13 |
Correct |
50 ms |
3072 KB |
Output is correct - L* = 40 |
14 |
Correct |
49 ms |
3056 KB |
Output is correct - L* = 40 |
15 |
Correct |
49 ms |
3072 KB |
Output is correct - L* = 40 |
16 |
Correct |
50 ms |
3056 KB |
Output is correct - L* = 40 |
17 |
Correct |
52 ms |
3072 KB |
Output is correct - L* = 40 |
18 |
Correct |
51 ms |
3072 KB |
Output is correct - L* = 40 |
19 |
Correct |
49 ms |
3072 KB |
Output is correct - L* = 40 |
20 |
Correct |
50 ms |
3072 KB |
Output is correct - L* = 40 |
21 |
Correct |
50 ms |
3072 KB |
Output is correct - L* = 40 |
22 |
Correct |
50 ms |
3072 KB |
Output is correct - L* = 40 |
23 |
Correct |
49 ms |
3072 KB |
Output is correct - L* = 40 |
24 |
Correct |
51 ms |
3056 KB |
Output is correct - L* = 40 |
25 |
Correct |
51 ms |
3056 KB |
Output is correct - L* = 40 |
26 |
Correct |
49 ms |
3072 KB |
Output is correct - L* = 40 |
27 |
Correct |
50 ms |
3056 KB |
Output is correct - L* = 40 |
28 |
Correct |
50 ms |
3072 KB |
Output is correct - L* = 40 |
29 |
Correct |
49 ms |
3072 KB |
Output is correct - L* = 40 |
30 |
Correct |
49 ms |
3072 KB |
Output is correct - L* = 40 |
31 |
Correct |
50 ms |
3056 KB |
Output is correct - L* = 40 |
32 |
Correct |
50 ms |
3072 KB |
Output is correct - L* = 40 |
33 |
Correct |
49 ms |
3072 KB |
Output is correct - L* = 40 |
34 |
Correct |
50 ms |
3072 KB |
Output is correct - L* = 40 |
35 |
Correct |
49 ms |
3072 KB |
Output is correct - L* = 40 |
36 |
Correct |
51 ms |
3072 KB |
Output is correct - L* = 40 |
37 |
Correct |
50 ms |
3072 KB |
Output is correct - L* = 40 |
38 |
Correct |
49 ms |
3072 KB |
Output is correct - L* = 40 |
39 |
Correct |
52 ms |
3072 KB |
Output is correct - L* = 40 |
40 |
Correct |
50 ms |
3056 KB |
Output is correct - L* = 40 |