Submission #260855

#TimeUsernameProblemLanguageResultExecution timeMemory
260855arnold518Broken Device (JOI17_broken_device)C++14
0 / 100
2 ms1044 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 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; }
#Verdict Execution timeMemoryGrader output
Fetching results...