제출 #954908

#제출 시각아이디문제언어결과실행 시간메모리
954908efishelBroken Device (JOI17_broken_device)C++17
8 / 100
30 ms2660 KiB
#include <bits/stdc++.h> #include "Annalib.h" using namespace std; void Anna(int N, long long X, int k, int P[]){ int vis[200], a[200]{}, p=60, y; for(int i=0; i<N; i++)vis[i]=0; for(int i=0; i<k; i++){ vis[P[i]]=-1; } for(int i=0; i<N; i++){ if(p<0)break; if(vis[i]!=0)continue; y=(X>>p)%2; if(y==0){ a[i]=1; vis[i]=vis[i+1]=1; p--; } if(y==1 && vis[i+1]==0){ a[i]=vis[i]=a[i+1]=vis[i+1]=1; p--; } } for(int i=0; i<N; i++){ Set(i,a[i]); } return; }
#include <bits/stdc++.h> #include "Brunolib.h" using namespace std; long long Bruno(int N, int A[]){ long long res=0, p=60, vis[200]; for(int i=0; i<N; i++)vis[i]=0; for(int i=0; i<N; i++){ if(p<0)break; if(vis[i]==1 || A[i]==0)continue; if(A[i+1]) { res+=1ll<<p; vis[i+1]=1; } p--; } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...