Submission #954894

#TimeUsernameProblemLanguageResultExecution timeMemory
954894leo_2727Broken Device (JOI17_broken_device)C++17
51 / 100
30 ms2604 KiB
#include <bits/stdc++.h> #include <Annalib.h> typedef long long ll; using namespace std; void Anna( int N, ll X, int K, int P[] ){ int ar[N]={0}, s[60]={0}; for(int i=0;i<60;i++) if(X & ((ll)1<<i)) s[i]=1; for(int i=0;i<K;i++) ar[P[i]]=-1; int curr=0; for(int i=0;i<N;i++){ if(curr>59 || i+2>=N || (ar[i]==-1 || ar[i+1]==-1 || ar[i+2]==-1)) ar[i]=-1; else{ ar[i]=1; ar[i+1]=s[curr++]; ar[i+2]=s[curr++]; i+=2; } } for(int i=0;i<N;i++) (ar[i]==1) ? Set(i, 1) : Set(i, 0); }
#include <bits/stdc++.h> #include <Brunolib.h> typedef long long ll; using namespace std; ll Bruno(int N, int A[]){ ll ans=0, curr=0; for(int i=0;i<N;i++){ if(A[i]==1){ if(A[i+1]==1) ans|=((ll)1<<curr); curr++; if(A[i+2]==1) ans|=((ll)1<<curr); curr++; i+=2; if(curr>59) break; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...