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;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> a(n);
vector<pair<int, int>> b(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
int cnt = 1;
while (a[i] % 2 == 0) {
a[i] /= 2;
cnt *= 2;
}
b[i] = {cnt, a[i]};
}
int q;
cin >> q;
ll sum = 0;
int pnt = -1;
while (q--) {
ll x;
cin >> x;
while (pnt < n && sum + b[pnt + 1].first < x) {
sum += b[++pnt].first;
}
cout << b[pnt + 1].second << '\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... |