제출 #1144671

#제출 시각아이디문제언어결과실행 시간메모리
1144671SulABroken Device (JOI17_broken_device)C++20
51 / 100
23 ms1564 KiB
#include <bits/stdc++.h> #include "Annalib.h" using namespace std; void Anna( int N, long long X, int K, int P[] ){ bool bad[N],st[N+1]; st[N]=1; for(int i=0;i<N;i++){ bad[i]=0; st[i]=0; } for(int i=0;i<K;i++){ bad[P[i]]=1; } long long bit[60],cnt=0; for(int i=0;i<60;i++)bit[i]=0; while(X>0){ bit[cnt]=X%2; X/=2; cnt++; } cnt=0; for( int i = 0; i < N; i++ ){ if(i+2<N && cnt<60 && !bad[i] && !st[i] && !bad[i+1] && !st[i+1] && !bad[i+2] && !st[i+2]) { Set(i , 1); Set(i+1,bit[cnt++]); if(cnt<60){ Set(i+2,bit[cnt++]); st[i+2]=1; } st[i]=1; st[i+1]=1; /*if(cnt<60){ Set(i+3,bit[cnt++]); st[i+3]=1; }*/ } if(!st[i])Set(i,0); } }
#include <bits/stdc++.h> #include "Brunolib.h" using namespace std; long long Bruno( int N, int A[] ){ long long cnt=0,ans=0; for(int i=0;i<N-2;i++){ if(A[i]==1){ ans+=(1LL<<cnt)*A[i+1]; i++; cnt++; if(cnt==60)break; ans+=(1LL<<cnt)*A[i+1]; i++; cnt++; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...