제출 #1129575

#제출 시각아이디문제언어결과실행 시간메모리
1129575NewtonabcIntercastellar (JOI22_ho_t1)C++20
100 / 100
362 ms5340 KiB
#include<bits/stdc++.h> #define int long long using namespace std; const int N=2e5+10; long long arr[N],amt[N]; int cal(int i){ int cnt=0; while(arr[i]%2LL==0){ cnt++; arr[i]/=2LL; } return (1LL<<cnt); } signed main(){ int n; cin>>n; for(int i=1;i<=n;i++) cin>>arr[i]; for(int i=1;i<=n;i++){ amt[i]=cal(i); amt[i]+=amt[i-1]; } int q; cin>>q; while(q--){ int inp; cin>>inp; int idx=lower_bound(amt+1,amt+n+1,inp)-amt; cout<<arr[idx] <<"\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...