#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define maxn 151
void Anna(int N, long long X, int K, int P[]){
bool broken[maxn];
FOR(i,0,N-1) broken[i] = 0;
FOR(i,0,K-1) broken[P[i]] = 1;
ll idx = 0;
for (int i = 0; i < 150; i += 3){
if (idx >= 60){
FOR(j,i,149) Set(j,0);
break;
}
int num = 0;
bool A[3];
A[0] = A[1] = A[2] = 0;
FOR(j,i,i+2){
if (broken[j]){
A[j-i] = 1;
num++;
}
}
if (num > 1){
FOR(j,i,i+2) Set(j,0);
continue;
}else if (num == 1){
if ((X & ((ll)1<<idx))){
if (!A[2]){
Set(i,0); Set(i+1,0); Set(i+2,1);
}else{
Set(i,1); Set(i+1,1); Set(i+2,0);
}
idx++;
}else{
if (!A[1]){
Set(i,0); Set(i+1,1); Set(i+2,0);
idx++;
}else{
if ((X & ((ll)1<<(idx+1)))){
Set(i,1); Set(i+1,0); Set(i+2,0);
}else{
Set(i,1); Set(i+1,0); Set(i+2,1);
}
idx += 2;
}
}
}else{
string a = "";
if ((X & ((ll)1<<idx))) a += '1';
else a += '0';
if ((X & ((ll)1<<(idx+1)))) a += '1';
else a += '0';
if (a == "00"){
Set(i,1); Set(i+1,0); Set(i+2,1);
}else if (a == "01"){
Set(i,1); Set(i+1,0); Set(i+2,0);
}else if (a == "10"){
Set(i,0); Set(i+1,1); Set(i+2,1);
}else{
Set(i,1); Set(i+1,1); Set(i+2,1);
}
idx += 2;
}
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
long long Bruno(int N, int A[]){
string ans = "";
for (int i = 0; i < 150; i+=3){
string cur = "";
FOR(j,i,i+2){
if (A[j] == 1) cur += '1';
else cur += '0';
}
if (cur == "000") continue;
else if (cur == "001" || cur == "110") ans += '1';
else if (cur == "010") ans += '0';
else if (cur == "111") ans += "11";
else if (cur == "011") ans += "10";
else if (cur == "100") ans += "01";
else ans += "00";
}
ll lans = 0;
FOR(i,0,ans.size() - 1){
if (ans[i] == '1') lans |= ((ll)1<<(ll)i);
}
//cout<<lans<<'\n';
return lans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
53 ms |
3072 KB |
Output is correct - L* = 40 |
2 |
Correct |
53 ms |
3328 KB |
Output is correct - L* = 40 |
3 |
Correct |
52 ms |
3312 KB |
Output is correct - L* = 40 |
4 |
Correct |
52 ms |
3312 KB |
Output is correct - L* = 40 |
5 |
Correct |
53 ms |
3328 KB |
Output is correct - L* = 40 |
6 |
Correct |
52 ms |
3312 KB |
Output is correct - L* = 40 |
7 |
Correct |
52 ms |
3312 KB |
Output is correct - L* = 40 |
8 |
Correct |
53 ms |
3312 KB |
Output is correct - L* = 40 |
9 |
Correct |
55 ms |
3312 KB |
Output is correct - L* = 40 |
10 |
Correct |
63 ms |
3328 KB |
Output is correct - L* = 40 |
11 |
Correct |
57 ms |
3312 KB |
Output is correct - L* = 40 |
12 |
Correct |
64 ms |
3232 KB |
Output is correct - L* = 40 |
13 |
Correct |
62 ms |
3312 KB |
Output is correct - L* = 40 |
14 |
Correct |
52 ms |
3328 KB |
Output is correct - L* = 40 |
15 |
Correct |
53 ms |
3312 KB |
Output is correct - L* = 40 |
16 |
Correct |
51 ms |
3328 KB |
Output is correct - L* = 40 |
17 |
Correct |
61 ms |
3312 KB |
Output is correct - L* = 40 |
18 |
Correct |
52 ms |
3312 KB |
Output is correct - L* = 40 |
19 |
Correct |
61 ms |
3312 KB |
Output is correct - L* = 40 |
20 |
Correct |
57 ms |
3328 KB |
Output is correct - L* = 40 |
21 |
Correct |
52 ms |
3328 KB |
Output is correct - L* = 40 |
22 |
Correct |
55 ms |
3280 KB |
Output is correct - L* = 40 |
23 |
Correct |
56 ms |
3280 KB |
Output is correct - L* = 40 |
24 |
Correct |
57 ms |
3320 KB |
Output is correct - L* = 40 |
25 |
Correct |
55 ms |
3328 KB |
Output is correct - L* = 40 |
26 |
Correct |
56 ms |
3312 KB |
Output is correct - L* = 40 |
27 |
Correct |
55 ms |
3224 KB |
Output is correct - L* = 40 |
28 |
Correct |
55 ms |
3296 KB |
Output is correct - L* = 40 |
29 |
Correct |
61 ms |
3312 KB |
Output is correct - L* = 40 |
30 |
Correct |
54 ms |
3312 KB |
Output is correct - L* = 40 |
31 |
Correct |
53 ms |
3328 KB |
Output is correct - L* = 40 |
32 |
Correct |
56 ms |
3312 KB |
Output is correct - L* = 40 |
33 |
Correct |
56 ms |
3312 KB |
Output is correct - L* = 40 |
34 |
Correct |
60 ms |
3280 KB |
Output is correct - L* = 40 |
35 |
Correct |
55 ms |
3328 KB |
Output is correct - L* = 40 |
36 |
Correct |
55 ms |
3312 KB |
Output is correct - L* = 40 |
37 |
Correct |
58 ms |
3320 KB |
Output is correct - L* = 40 |
38 |
Correct |
55 ms |
3312 KB |
Output is correct - L* = 40 |
39 |
Correct |
57 ms |
3312 KB |
Output is correct - L* = 40 |
40 |
Correct |
53 ms |
3312 KB |
Output is correct - L* = 40 |