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