This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 200200;
int a[N], p[N];
ll qs[N];
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n;
cin >> n;
for (int i = 1;i <= n;i++) {
cin >> a[i];
p[i] = 1;
while (a[i] % 2 == 0) {
a[i] /= 2;
p[i] *= 2;
}
}
for (int i = 1;i <= n;i++) {
qs[i] = qs[i - 1] + p[i];
}
int q;
cin >> q;
while (q--) {
ll x;
cin >> x;
cout << a[lower_bound(qs + 1, qs + 1 + n, x) - qs] << '\n';
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |