#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
int n;
cin >> n;
vector<ll> a(n);
for (auto &i: a) cin >> i;
// precomp
ll cnt = 1;
set<pair<ll, ll>, greater<pair<ll, ll>>> s;
for (int i: a) {
int ctz = __builtin_ctz(i);
s.insert({cnt, i >> ctz});
cnt += 1LL << ctz;
}
// query
ll q, x;
cin >> q;
while (q--) {
cin >> x;
ll ans = s.lower_bound({x, INT_MAX})->second;
cout << ans << '\n';
}
}
signed main() {
cin.tie(0)->sync_with_stdio(0);
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... |