Submission #260868

# Submission time Handle Problem Language Result Execution time Memory
260868 2020-08-11T06:20:36 Z arnold518 Broken Device (JOI17_broken_device) C++14
85 / 100
56 ms 3312 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]={99, 32, 29, 67, 5, 23, 28, 49, 103, 138, 129, 1, 17, 85, 117, 65, 130, 66, 7, 37, 31, 102, 133, 124, 114, 125, 127, 42, 69, 109, 73, 84, 140, 135, 59, 52, 104, 80, 76, 50, 10, 98, 45, 27, 126, 119, 96, 72, 20, 121, 101, 136, 25, 144, 107, 149, 39, 81, 91, 86, 146, 64, 35, 77, 56, 118, 43, 57, 26, 68, 12, 18, 139, 38, 63, 93, 62, 111, 4, 3, 55, 24, 90, 2, 106, 92, 148, 143, 123, 13, 60, 15, 58, 113, 46, 134, 131, 105, 41, 44, 94, 120, 78, 122, 19, 22, 21, 14, 16, 115, 132, 40, 51, 95, 112, 100, 74, 147, 11, 87, 61, 110, 36, 47, 89, 75, 108, 33, 83, 128, 6, 145, 9, 0, 137, 97, 88, 79, 53, 116, 30, 70, 142, 48, 82, 141, 54, 71, 8, 34};
static const int QQ[160]={133, 11, 83, 79, 78, 4, 130, 18, 148, 132, 40, 118, 70, 89, 107, 91, 108, 12, 71, 104, 48, 106, 105, 5, 81, 52, 68, 43, 6, 2, 140, 20, 1, 127, 149, 62, 122, 19, 73, 56, 111, 98, 27, 66, 99, 42, 94, 123, 143, 7, 39, 112, 35, 138, 146, 80, 64, 67, 92, 34, 90, 120, 76, 74, 61, 15, 17, 3, 69, 28, 141, 147, 47, 30, 116, 125, 38, 63, 102, 137, 37, 57, 144, 128, 31, 13, 59, 119, 136, 124, 82, 58, 85, 75, 100, 113, 46, 135, 41, 0, 115, 50, 21, 8, 36, 97, 84, 54, 126, 29, 121, 77, 114, 93, 24, 109, 139, 14, 65, 45, 101, 49, 103, 88, 23, 25, 44, 26, 129, 10, 16, 96, 110, 22, 95, 33, 51, 134, 9, 72, 32, 145, 142, 87, 53, 131, 60, 117, 86, 55};

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

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;
}
# Verdict Execution time Memory Grader output
1 Partially correct 46 ms 3072 KB Output is partially correct - L* = 39
2 Correct 46 ms 3072 KB Output is correct - L* = 40
3 Partially correct 47 ms 3072 KB Output is partially correct - L* = 39
4 Partially correct 47 ms 3008 KB Output is partially correct - L* = 39
5 Partially correct 45 ms 3056 KB Output is partially correct - L* = 38
6 Partially correct 46 ms 3072 KB Output is partially correct - L* = 39
7 Partially correct 54 ms 3072 KB Output is partially correct - L* = 39
8 Partially correct 50 ms 3056 KB Output is partially correct - L* = 39
9 Correct 51 ms 3072 KB Output is correct - L* = 40
10 Partially correct 51 ms 3056 KB Output is partially correct - L* = 38
11 Partially correct 47 ms 3056 KB Output is partially correct - L* = 38
12 Partially correct 50 ms 3056 KB Output is partially correct - L* = 39
13 Partially correct 45 ms 3056 KB Output is partially correct - L* = 38
14 Partially correct 48 ms 3056 KB Output is partially correct - L* = 38
15 Correct 49 ms 3072 KB Output is correct - L* = 40
16 Partially correct 46 ms 3064 KB Output is partially correct - L* = 38
17 Partially correct 45 ms 3072 KB Output is partially correct - L* = 39
18 Partially correct 48 ms 3064 KB Output is partially correct - L* = 39
19 Partially correct 45 ms 3056 KB Output is partially correct - L* = 39
20 Correct 45 ms 3064 KB Output is correct - L* = 40
21 Partially correct 46 ms 3072 KB Output is partially correct - L* = 38
22 Partially correct 45 ms 3072 KB Output is partially correct - L* = 38
23 Partially correct 45 ms 3072 KB Output is partially correct - L* = 38
24 Partially correct 45 ms 3072 KB Output is partially correct - L* = 39
25 Partially correct 46 ms 3056 KB Output is partially correct - L* = 39
26 Partially correct 45 ms 3056 KB Output is partially correct - L* = 39
27 Partially correct 45 ms 3056 KB Output is partially correct - L* = 39
28 Partially correct 45 ms 3072 KB Output is partially correct - L* = 38
29 Partially correct 46 ms 3312 KB Output is partially correct - L* = 39
30 Partially correct 45 ms 3056 KB Output is partially correct - L* = 38
31 Partially correct 45 ms 3072 KB Output is partially correct - L* = 37
32 Partially correct 45 ms 3064 KB Output is partially correct - L* = 37
33 Partially correct 45 ms 3056 KB Output is partially correct - L* = 38
34 Partially correct 49 ms 3072 KB Output is partially correct - L* = 38
35 Partially correct 45 ms 3072 KB Output is partially correct - L* = 38
36 Partially correct 45 ms 3056 KB Output is partially correct - L* = 38
37 Partially correct 45 ms 3056 KB Output is partially correct - L* = 39
38 Partially correct 45 ms 3072 KB Output is partially correct - L* = 39
39 Partially correct 45 ms 3072 KB Output is partially correct - L* = 38
40 Partially correct 56 ms 3056 KB Output is partially correct - L* = 38