#include <bits/stdc++.h>
#define int long long
std::pair<int, int> cnt1(int num, int cnt) {
if (num % 2 != 0) {
return {num, cnt};
}
return cnt1(num / 2, cnt * 2);
}
int32_t main() {
int n;
std::cin >> n;
std::vector<std::pair<int, int>> all;
for (int i = 0; i < n; i++) {
int x;
std::cin >> x;
all.push_back(cnt1(x, 1));
}
int q;
std::cin >> q;
int now = 0;
int l = 0;
while (q--) {
int x;
std::cin >> x;
while (now + all[l].second < x) {
now += all[l++].second;
}
std::cout << all[l].first << std::endl;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |