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