#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define fi first
#define se second
const int N = 2e5+5;
int n,q,a[N],sl[N],pre[N];
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
for(int i = 1; i <= n; i++){
cin >> a[i];
sl[i] = 1;
while(a[i] % 2 == 0){
a[i] /= 2;
sl[i] *= 2;
}
}
for(int i = 1; i <= n; i++) pre[i] = pre[i-1]+sl[i];
cin >> q;
while(q--){
int x;
cin >> x;
int cc = lower_bound(pre+1,pre+n+1,x)-pre;
cout << a[cc] << "\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... |