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 n;
int a[200005]; long long psum[200005];
int q; long long x;
int main() {
ios::sync_with_stdio(false);
cin >> n;
for(int i=1; i<=n; i++) cin >> a[i];
for(int i=1; i<=n; i++) {
psum[i] = psum[i-1];
int tmp = a[i];
while(a[i]%2==0) {
a[i]/=2;
}
psum[i] += tmp/a[i];
}
cin >> q;
while(q--) {
cin >> x;
int tmp = lower_bound(psum+1, psum+n+1, x)-psum;
cout << a[tmp] << "\n";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |