#include<bits/stdc++.h>
typedef long long ll;
#define pii pair<ll, ll>
#define fi first
#define se second
#define endl '\n'
#define TASK ""
#define N 200005
#define LOG 17
using namespace std;
bool ghuy4g;
ll n, a[N], b[N], pf[N], q;
bool klinh;
signed main() {
// freopen("test.inp", "r", stdin);
//freopen("test.out", "w", stdout);
//srand(time(0));
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for (int i = 1; i <= n; i ++) {
cin >> a[i];
ll cnt = 1, cur = a[i];
while (true) {
if (cur % 2 == 1) break;
cnt *= 2;
cur /= 2;
}
b[i] = cur;
pf[i] = pf[i - 1] + cnt;
}
cin >> q;
for (int i = 1; i <= q; i ++) {
ll id;
cin >> id;
ll it = lower_bound(pf + 1, pf + 1 + n, id) - pf;
cout << b[it] << endl;
}
cerr << fabs(&klinh - &ghuy4g) / double(1024 * 1024);
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |