#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
static const int MAXN = 150;
static const int MAXK = 40;
static int N, K, *P;
static ll X;
static int A[MAXN+10];
static const int PP[160]={59, 20, 93, 17, 38, 32, 2, 108, 137, 126, 105, 148, 143, 89, 62, 123, 86, 41, 56, 15, 81, 149, 6, 83, 139, 107, 60, 18, 88, 117, 11, 26, 133, 96, 63, 33, 77, 19, 65, 87, 7, 42, 119, 16, 53, 97, 147, 134, 98, 80, 21, 29, 106, 114, 118, 74, 4, 145, 99, 95, 127, 48, 110, 72, 75, 70, 90, 131, 52, 130, 12, 69, 39, 138, 100, 91, 112, 73, 55, 82, 27, 129, 136, 51, 101, 71, 142, 22, 84, 66, 102, 67, 128, 34, 144, 31, 61, 10, 30, 115, 64, 68, 35, 76, 78, 46, 122, 45, 28, 13, 116, 9, 125, 49, 57, 109, 85, 120, 140, 23, 1, 141, 146, 5, 104, 135, 8, 3, 14, 92, 0, 79, 103, 37, 36, 43, 25, 94, 44, 132, 50, 54, 24, 111, 47, 121, 58, 40, 113, 124};
static const int QQ[160]={130, 120, 6, 127, 56, 123, 22, 40, 126, 111, 97, 30, 70, 109, 128, 19, 43, 3, 27, 37, 1, 50, 87, 119, 142, 136, 31, 80, 108, 51, 98, 95, 5, 35, 93, 102, 134, 133, 4, 72, 147, 17, 41, 135, 138, 107, 105, 144, 61, 113, 140, 83, 68, 44, 141, 78, 18, 114, 146, 0, 26, 96, 14, 34, 100, 38, 89, 91, 101, 71, 65, 85, 63, 77, 55, 64, 103, 36, 104, 131, 49, 20, 79, 23, 88, 116, 16, 39, 28, 13, 66, 75, 129, 2, 137, 59, 33, 45, 48, 58, 74, 84, 90, 132, 124, 10, 52, 25, 7, 115, 62, 143, 76, 148, 53, 99, 110, 29, 54, 42, 117, 145, 106, 15, 149, 112, 9, 60, 92, 81, 69, 67, 139, 32, 47, 125, 82, 8, 73, 24, 118, 121, 86, 12, 94, 57, 122, 46, 11, 21};
void Anna(int _N, ll _X, int _K, int _P[])
{
N=_N; X=_X; K=_K; P=_P;
for(int i=0; i<K; i++) A[QQ[P[i]]]=-1;
ll now=X;
for(int i=0; i<N; i+=2)
{
if(A[i]==-1 || A[i+1]==-1)
{
A[i]=0; A[i+1]=0;
}
else
{
if(now%3==0) A[i]=0, A[i+1]=1;
else if(now%3==1) A[i]=1, A[i+1]=0;
else if(now%3==2) A[i]=1, A[i+1]=1;
now/=3;
}
}
for(int i=0; i<N; i++) Set(PP[i], A[i]);
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
static int N, *A;
static const int PP[160]={59, 20, 93, 17, 38, 32, 2, 108, 137, 126, 105, 148, 143, 89, 62, 123, 86, 41, 56, 15, 81, 149, 6, 83, 139, 107, 60, 18, 88, 117, 11, 26, 133, 96, 63, 33, 77, 19, 65, 87, 7, 42, 119, 16, 53, 97, 147, 134, 98, 80, 21, 29, 106, 114, 118, 74, 4, 145, 99, 95, 127, 48, 110, 72, 75, 70, 90, 131, 52, 130, 12, 69, 39, 138, 100, 91, 112, 73, 55, 82, 27, 129, 136, 51, 101, 71, 142, 22, 84, 66, 102, 67, 128, 34, 144, 31, 61, 10, 30, 115, 64, 68, 35, 76, 78, 46, 122, 45, 28, 13, 116, 9, 125, 49, 57, 109, 85, 120, 140, 23, 1, 141, 146, 5, 104, 135, 8, 3, 14, 92, 0, 79, 103, 37, 36, 43, 25, 94, 44, 132, 50, 54, 24, 111, 47, 121, 58, 40, 113, 124};
static const int QQ[160]={130, 120, 6, 127, 56, 123, 22, 40, 126, 111, 97, 30, 70, 109, 128, 19, 43, 3, 27, 37, 1, 50, 87, 119, 142, 136, 31, 80, 108, 51, 98, 95, 5, 35, 93, 102, 134, 133, 4, 72, 147, 17, 41, 135, 138, 107, 105, 144, 61, 113, 140, 83, 68, 44, 141, 78, 18, 114, 146, 0, 26, 96, 14, 34, 100, 38, 89, 91, 101, 71, 65, 85, 63, 77, 55, 64, 103, 36, 104, 131, 49, 20, 79, 23, 88, 116, 16, 39, 28, 13, 66, 75, 129, 2, 137, 59, 33, 45, 48, 58, 74, 84, 90, 132, 124, 10, 52, 25, 7, 115, 62, 143, 76, 148, 53, 99, 110, 29, 54, 42, 117, 145, 106, 15, 149, 112, 9, 60, 92, 81, 69, 67, 139, 32, 47, 125, 82, 8, 73, 24, 118, 121, 86, 12, 94, 57, 122, 46, 11, 21};
ll Bruno(int _N, int _A[])
{
N=_N; A=_A;
ll ret=0;
for(int i=N-2; i>=0; i-=2)
{
if(A[PP[i]]==0 && A[PP[i+1]]==0) continue;
if(A[PP[i]]==0 && A[PP[i+1]]==1) ret=ret*3+0;
if(A[PP[i]]==1 && A[PP[i+1]]==0) ret=ret*3+1;
if(A[PP[i]]==1 && A[PP[i+1]]==1) ret=ret*3+2;
}
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
46 ms |
3312 KB |
Output is correct - L* = 40 |
2 |
Partially correct |
45 ms |
3312 KB |
Output is partially correct - L* = 38 |
3 |
Correct |
45 ms |
3320 KB |
Output is correct - L* = 40 |
4 |
Partially correct |
45 ms |
3312 KB |
Output is partially correct - L* = 38 |
5 |
Partially correct |
48 ms |
3312 KB |
Output is partially correct - L* = 38 |
6 |
Partially correct |
45 ms |
3312 KB |
Output is partially correct - L* = 39 |
7 |
Partially correct |
48 ms |
3328 KB |
Output is partially correct - L* = 39 |
8 |
Partially correct |
45 ms |
3312 KB |
Output is partially correct - L* = 38 |
9 |
Partially correct |
60 ms |
3312 KB |
Output is partially correct - L* = 39 |
10 |
Correct |
47 ms |
3320 KB |
Output is correct - L* = 40 |
11 |
Partially correct |
45 ms |
3312 KB |
Output is partially correct - L* = 38 |
12 |
Partially correct |
48 ms |
3312 KB |
Output is partially correct - L* = 38 |
13 |
Partially correct |
47 ms |
3312 KB |
Output is partially correct - L* = 38 |
14 |
Partially correct |
46 ms |
3312 KB |
Output is partially correct - L* = 39 |
15 |
Partially correct |
45 ms |
3312 KB |
Output is partially correct - L* = 39 |
16 |
Partially correct |
54 ms |
3312 KB |
Output is partially correct - L* = 39 |
17 |
Partially correct |
45 ms |
3328 KB |
Output is partially correct - L* = 39 |
18 |
Partially correct |
50 ms |
3312 KB |
Output is partially correct - L* = 39 |
19 |
Partially correct |
50 ms |
3312 KB |
Output is partially correct - L* = 39 |
20 |
Partially correct |
50 ms |
3312 KB |
Output is partially correct - L* = 38 |
21 |
Partially correct |
47 ms |
3312 KB |
Output is partially correct - L* = 38 |
22 |
Partially correct |
45 ms |
3328 KB |
Output is partially correct - L* = 39 |
23 |
Partially correct |
55 ms |
3312 KB |
Output is partially correct - L* = 39 |
24 |
Partially correct |
46 ms |
3328 KB |
Output is partially correct - L* = 38 |
25 |
Partially correct |
46 ms |
3312 KB |
Output is partially correct - L* = 37 |
26 |
Partially correct |
45 ms |
3312 KB |
Output is partially correct - L* = 38 |
27 |
Partially correct |
46 ms |
3312 KB |
Output is partially correct - L* = 38 |
28 |
Partially correct |
47 ms |
3328 KB |
Output is partially correct - L* = 38 |
29 |
Partially correct |
48 ms |
3312 KB |
Output is partially correct - L* = 39 |
30 |
Partially correct |
45 ms |
3312 KB |
Output is partially correct - L* = 38 |
31 |
Partially correct |
46 ms |
3376 KB |
Output is partially correct - L* = 37 |
32 |
Partially correct |
46 ms |
3192 KB |
Output is partially correct - L* = 37 |
33 |
Partially correct |
47 ms |
3312 KB |
Output is partially correct - L* = 39 |
34 |
Partially correct |
45 ms |
3312 KB |
Output is partially correct - L* = 38 |
35 |
Partially correct |
52 ms |
3328 KB |
Output is partially correct - L* = 39 |
36 |
Partially correct |
48 ms |
3344 KB |
Output is partially correct - L* = 38 |
37 |
Partially correct |
45 ms |
3312 KB |
Output is partially correct - L* = 39 |
38 |
Partially correct |
45 ms |
3328 KB |
Output is partially correct - L* = 39 |
39 |
Partially correct |
46 ms |
3312 KB |
Output is partially correct - L* = 38 |
40 |
Partially correct |
45 ms |
3312 KB |
Output is partially correct - L* = 39 |