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;
int main() {
int n;
cin >> n;
vector<pair<int, int>> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i].first;
v[i].second = 1;
while (!bool(v[i].first & 1)) {
v[i].first >>= 1;
v[i].second <<= 1;
}
}
int q;
cin >> q;
int ptr = 0;
long long ps = 0;
while (q--) {
long long x;
cin >> x;
while (x - ps > v[ptr].second) {
ps += v[ptr].second;
ptr++;
}
cout << v[ptr].first << 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... |