#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]={30, 8, 123, 34, 33, 72, 115, 26, 10, 69, 71, 83, 114, 0, 55, 89, 121, 93, 133, 76, 107, 95, 21, 137, 41, 118, 52, 73, 79, 42, 138, 38, 15, 45, 60, 16, 3, 110, 58, 20, 67, 112, 131, 1, 101, 70, 132, 120, 122, 24, 13, 102, 135, 14, 142, 39, 144, 35, 85, 100, 23, 87, 145, 32, 119, 126, 11, 53, 7, 59, 94, 6, 146, 47, 148, 96, 18, 103, 111, 128, 44, 124, 17, 57, 2, 66, 46, 51, 4, 31, 91, 64, 141, 36, 84, 28, 143, 99, 29, 61, 54, 86, 27, 117, 75, 139, 49, 65, 106, 134, 136, 98, 5, 92, 140, 130, 97, 147, 88, 37, 108, 40, 43, 78, 77, 105, 125, 82, 56, 19, 12, 149, 9, 109, 104, 50, 22, 129, 116, 48, 62, 81, 80, 68, 25, 63, 90, 113, 74, 127};
static const int QQ[160]={13, 43, 84, 36, 88, 112, 71, 68, 1, 132, 8, 66, 130, 50, 53, 32, 35, 82, 76, 129, 39, 22, 136, 60, 49, 144, 7, 102, 95, 98, 0, 89, 63, 4, 3, 57, 93, 119, 31, 55, 121, 24, 29, 122, 80, 33, 86, 73, 139, 106, 135, 87, 26, 67, 100, 14, 128, 83, 38, 69, 34, 99, 140, 145, 91, 107, 85, 40, 143, 9, 45, 10, 5, 27, 148, 104, 19, 124, 123, 28, 142, 141, 127, 11, 94, 58, 101, 61, 118, 15, 146, 90, 113, 17, 70, 21, 75, 116, 111, 97, 59, 44, 51, 77, 134, 125, 108, 20, 120, 133, 37, 78, 41, 147, 12, 6, 138, 103, 25, 64, 47, 16, 48, 2, 81, 126, 65, 149, 79, 137, 115, 42, 46, 18, 109, 52, 110, 23, 30, 105, 114, 92, 54, 96, 56, 62, 72, 117, 74, 131};
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]={30, 8, 123, 34, 33, 72, 115, 26, 10, 69, 71, 83, 114, 0, 55, 89, 121, 93, 133, 76, 107, 95, 21, 137, 41, 118, 52, 73, 79, 42, 138, 38, 15, 45, 60, 16, 3, 110, 58, 20, 67, 112, 131, 1, 101, 70, 132, 120, 122, 24, 13, 102, 135, 14, 142, 39, 144, 35, 85, 100, 23, 87, 145, 32, 119, 126, 11, 53, 7, 59, 94, 6, 146, 47, 148, 96, 18, 103, 111, 128, 44, 124, 17, 57, 2, 66, 46, 51, 4, 31, 91, 64, 141, 36, 84, 28, 143, 99, 29, 61, 54, 86, 27, 117, 75, 139, 49, 65, 106, 134, 136, 98, 5, 92, 140, 130, 97, 147, 88, 37, 108, 40, 43, 78, 77, 105, 125, 82, 56, 19, 12, 149, 9, 109, 104, 50, 22, 129, 116, 48, 62, 81, 80, 68, 25, 63, 90, 113, 74, 127};
static const int QQ[160]={13, 43, 84, 36, 88, 112, 71, 68, 1, 132, 8, 66, 130, 50, 53, 32, 35, 82, 76, 129, 39, 22, 136, 60, 49, 144, 7, 102, 95, 98, 0, 89, 63, 4, 3, 57, 93, 119, 31, 55, 121, 24, 29, 122, 80, 33, 86, 73, 139, 106, 135, 87, 26, 67, 100, 14, 128, 83, 38, 69, 34, 99, 140, 145, 91, 107, 85, 40, 143, 9, 45, 10, 5, 27, 148, 104, 19, 124, 123, 28, 142, 141, 127, 11, 94, 58, 101, 61, 118, 15, 146, 90, 113, 17, 70, 21, 75, 116, 111, 97, 59, 44, 51, 77, 134, 125, 108, 20, 120, 133, 37, 78, 41, 147, 12, 6, 138, 103, 25, 64, 47, 16, 48, 2, 81, 126, 65, 149, 79, 137, 115, 42, 46, 18, 109, 52, 110, 23, 30, 105, 114, 92, 54, 96, 56, 62, 72, 117, 74, 131};
ll Bruno(int _N, int _A[])
{
N=_N; A=_A;
ll ret=0;
for(int i=N-2; i>=0; i-=2)
{
if(A[QQ[i]]==0 && A[QQ[i+1]]==0) continue;
if(A[QQ[i]]==0 && A[QQ[i+1]]==1) ret=ret*3+0;
if(A[QQ[i]]==1 && A[QQ[i+1]]==0) ret=ret*3+1;
if(A[QQ[i]]==1 && A[QQ[i+1]]==1) ret=ret*3+2;
}
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
48 ms |
3056 KB |
Output isn't correct - L* = 0 |
2 |
Partially correct |
46 ms |
3072 KB |
Output isn't correct - L* = 0 |
3 |
Partially correct |
51 ms |
3064 KB |
Output isn't correct - L* = 0 |
4 |
Partially correct |
47 ms |
3072 KB |
Output isn't correct - L* = 0 |
5 |
Partially correct |
45 ms |
3072 KB |
Output isn't correct - L* = 0 |
6 |
Partially correct |
45 ms |
3072 KB |
Output isn't correct - L* = 0 |
7 |
Partially correct |
45 ms |
3368 KB |
Output isn't correct - L* = 0 |
8 |
Partially correct |
47 ms |
3072 KB |
Output isn't correct - L* = 0 |
9 |
Partially correct |
46 ms |
3072 KB |
Output isn't correct - L* = 0 |
10 |
Partially correct |
45 ms |
3072 KB |
Output isn't correct - L* = 0 |
11 |
Partially correct |
45 ms |
3072 KB |
Output isn't correct - L* = 0 |
12 |
Partially correct |
50 ms |
3056 KB |
Output isn't correct - L* = 0 |
13 |
Partially correct |
45 ms |
3056 KB |
Output isn't correct - L* = 0 |
14 |
Partially correct |
46 ms |
3072 KB |
Output isn't correct - L* = 0 |
15 |
Partially correct |
48 ms |
3056 KB |
Output isn't correct - L* = 0 |
16 |
Partially correct |
48 ms |
3312 KB |
Output isn't correct - L* = 0 |
17 |
Partially correct |
45 ms |
3056 KB |
Output isn't correct - L* = 0 |
18 |
Partially correct |
45 ms |
3056 KB |
Output isn't correct - L* = 0 |
19 |
Partially correct |
45 ms |
3072 KB |
Output isn't correct - L* = 0 |
20 |
Partially correct |
47 ms |
3072 KB |
Output isn't correct - L* = 0 |
21 |
Partially correct |
50 ms |
3072 KB |
Output isn't correct - L* = 0 |
22 |
Partially correct |
45 ms |
3072 KB |
Output isn't correct - L* = 0 |
23 |
Partially correct |
47 ms |
3072 KB |
Output isn't correct - L* = 0 |
24 |
Partially correct |
45 ms |
3072 KB |
Output isn't correct - L* = 0 |
25 |
Partially correct |
46 ms |
3072 KB |
Output isn't correct - L* = 0 |
26 |
Partially correct |
45 ms |
3072 KB |
Output isn't correct - L* = 0 |
27 |
Partially correct |
45 ms |
3072 KB |
Output isn't correct - L* = 0 |
28 |
Partially correct |
46 ms |
3072 KB |
Output isn't correct - L* = 0 |
29 |
Partially correct |
53 ms |
3072 KB |
Output isn't correct - L* = 0 |
30 |
Partially correct |
49 ms |
3072 KB |
Output isn't correct - L* = 0 |
31 |
Partially correct |
48 ms |
3056 KB |
Output isn't correct - L* = 0 |
32 |
Partially correct |
54 ms |
3056 KB |
Output isn't correct - L* = 0 |
33 |
Partially correct |
45 ms |
3056 KB |
Output isn't correct - L* = 0 |
34 |
Partially correct |
45 ms |
3056 KB |
Output isn't correct - L* = 0 |
35 |
Partially correct |
46 ms |
3072 KB |
Output isn't correct - L* = 0 |
36 |
Partially correct |
45 ms |
3056 KB |
Output isn't correct - L* = 0 |
37 |
Partially correct |
45 ms |
2920 KB |
Output isn't correct - L* = 0 |
38 |
Partially correct |
50 ms |
3064 KB |
Output isn't correct - L* = 0 |
39 |
Partially correct |
45 ms |
3072 KB |
Output isn't correct - L* = 0 |
40 |
Partially correct |
47 ms |
3072 KB |
Output isn't correct - L* = 0 |