#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
vector<int> a(n + 1);
vector<pair<int,int>> v;
int index = 1;
for(int i = 1; i <= n; i++) {
cin >> a[i];
int cnt = 0;
while(a[i] > 0 && a[i] % 2 == 0) {
a[i] /= 2;
cnt += 1;
}
v.push_back({index, a[i]});
index += pow(2, cnt);
}
int j = 0;
int q;
cin >> q;
while(q--) {
int x;
cin >> x;
while(x >= v[j].first && j < v.size()) {
j += 1;
}
cout << v[j - 1].second << "\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... |