Submission #260789

#TimeUsernameProblemLanguageResultExecution timeMemory
260789arnold518Broken Device (JOI17_broken_device)C++14
85 / 100
51 ms3584 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]; 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(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; ll Bruno(int _N, int _A[]) { N=_N; A=_A; ll ret=0; for(int i=N-2; i>=0; i-=2) { if(A[i]==0 && A[i+1]==0) continue; if(A[i]==0 && A[i+1]==1) ret=ret*3+0; if(A[i]==1 && A[i+1]==0) ret=ret*3+1; if(A[i]==1 && A[i+1]==1) ret=ret*3+2; } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...