Submission #260865

# Submission time Handle Problem Language Result Execution time Memory
260865 2020-08-11T06:18:04 Z arnold518 Broken Device (JOI17_broken_device) C++14
85 / 100
68 ms 3840 KB
#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 QQ[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 PP[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;
}
# Verdict Execution time Memory Grader output
1 Partially correct 45 ms 3328 KB Output is partially correct - L* = 38
2 Partially correct 49 ms 3840 KB Output is partially correct - L* = 38
3 Partially correct 46 ms 3312 KB Output is partially correct - L* = 38
4 Partially correct 50 ms 3328 KB Output is partially correct - L* = 38
5 Partially correct 54 ms 3328 KB Output is partially correct - L* = 38
6 Partially correct 60 ms 3328 KB Output is partially correct - L* = 38
7 Partially correct 46 ms 3320 KB Output is partially correct - L* = 38
8 Partially correct 54 ms 3312 KB Output is partially correct - L* = 39
9 Partially correct 57 ms 3264 KB Output is partially correct - L* = 39
10 Partially correct 47 ms 3328 KB Output is partially correct - L* = 38
11 Partially correct 46 ms 3328 KB Output is partially correct - L* = 37
12 Partially correct 53 ms 3184 KB Output is partially correct - L* = 37
13 Partially correct 52 ms 3312 KB Output is partially correct - L* = 38
14 Partially correct 46 ms 3328 KB Output is partially correct - L* = 38
15 Partially correct 46 ms 3312 KB Output is partially correct - L* = 38
16 Partially correct 50 ms 3328 KB Output is partially correct - L* = 38
17 Partially correct 54 ms 3120 KB Output is partially correct - L* = 39
18 Partially correct 47 ms 3312 KB Output is partially correct - L* = 39
19 Partially correct 68 ms 3312 KB Output is partially correct - L* = 38
20 Partially correct 67 ms 3312 KB Output is partially correct - L* = 38
21 Partially correct 47 ms 3328 KB Output is partially correct - L* = 38
22 Partially correct 45 ms 3312 KB Output is partially correct - L* = 38
23 Partially correct 51 ms 3320 KB Output is partially correct - L* = 38
24 Partially correct 47 ms 3328 KB Output is partially correct - L* = 38
25 Partially correct 46 ms 3328 KB Output is partially correct - L* = 39
26 Partially correct 47 ms 3312 KB Output is partially correct - L* = 38
27 Partially correct 45 ms 3328 KB Output is partially correct - L* = 38
28 Partially correct 45 ms 3376 KB Output is partially correct - L* = 38
29 Partially correct 45 ms 3312 KB Output is partially correct - L* = 37
30 Partially correct 46 ms 3328 KB Output is partially correct - L* = 38
31 Partially correct 45 ms 3312 KB Output is partially correct - L* = 38
32 Partially correct 45 ms 3312 KB Output is partially correct - L* = 38
33 Partially correct 45 ms 3312 KB Output is partially correct - L* = 38
34 Partially correct 45 ms 3328 KB Output is partially correct - L* = 38
35 Partially correct 46 ms 3328 KB Output is partially correct - L* = 38
36 Partially correct 45 ms 3328 KB Output is partially correct - L* = 37
37 Partially correct 45 ms 3312 KB Output is partially correct - L* = 38
38 Partially correct 45 ms 3312 KB Output is partially correct - L* = 38
39 Partially correct 45 ms 3328 KB Output is partially correct - L* = 38
40 Partially correct 46 ms 3328 KB Output is partially correct - L* = 38