#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define vi vector<long long>
#define all(x) x.begin(), x.end()
#define endl "\n"
void solution();
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
solution();
return 0;
}
void solution() {
int n; cin >> n;
vi a(n), b(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
ll x = a[i];
int z = 1;
while (x&1^1) {z += z; x /= 2;}
b[i] = z;
if (i > 0)
b[i] += b[i-1];
}
vi temp(n);
for (int i = 0; i < n; i++) {
while (a[i]&1^1) a[i]/=2;
temp[i] = a[i];
}
ll q; cin >> q;
ll j = 0;
while (q--) {
ll x; cin >> x;
while (j < n && b[j] < x) j++;
cout << temp[j] << 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... |