#include <bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1e10;
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> arr(n);
for(int&i:arr)cin>>i;
int q;
cin >> q;
vector<int> queries(q);
for(int&i:queries)cin>>i;
auto iter = queries.begin();
int total = 0;
for(int&i:arr) {
int cnt = 1;
while(i%2==0) {
i>>=1;
cnt*=2;
}
total+=cnt;
while(iter!=queries.end() and *iter<=total) {
cout << i << '\n';
iter++;
}
}
assert(iter==queries.end());
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |