Submission #260867

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