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>
#define ll long long
using namespace std;
ll n, q, x, idx, a[200010], ans[200010];
ll div2(ll pc) {
int i;
for(i=1; pc%2 == 0; i++) {
pc /= 2;
}
return pow(2, i-1);
}
int main() {
cin.tie(0)->sync_with_stdio(0);
cin >> n;
for(int i=1; i<=n; i++) {
cin >> a[i];
ans[i] = div2(a[i]);
ans[i] += ans[i-1];
}
cin >> q;
while(q--) {
cin >> x;
idx = lower_bound(ans+1, ans+n+1, x) - ans;
cout << a[idx]/(ans[idx]-ans[idx-1]) << "\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... |