#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2e5 + 24;
int n, q, a[N]; ll b[N];
int x[N];
void solve() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i]; b[i] = 1;
while (a[i] % 2 == 0) {
b[i] *= 2; a[i] /= 2;
}
}
for (int i = 1; i <= n; i++) {
b[i] += b[i - 1];
}
cin >> q;
for (int i = 1, j = 1; i <= q; i++) {
cin >> x[i];
while (j <= n && b[j] < x[i]) j++;
cout << a[j] << '\n';
}
}
int main() {
cin.tie(0) -> sync_with_stdio(0);
int T = 1; // cin >> T;
while (T--) {
solve();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |