#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |