Submission #1129572

#TimeUsernameProblemLanguageResultExecution timeMemory
1129572NewtonabcIntercastellar (JOI22_ho_t1)C++17
25 / 100
294 ms3812 KiB
#include<bits/stdc++.h> using namespace std; const int N=2e5+10; long long arr[N],amt[N]; int cal(int i){ int cnt=0; while(arr[i]%2==0){ cnt++; arr[i]/=2; } return (1<<cnt); } int 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...