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 int long long
using namespace std;
int n,q, ans[200200], arr[200200];
int solve(int n){
int idx = 1;
while(n%2==0){
n/=2;
idx++;
}
return pow(2, idx - 1);
}
signed main(){
cin.tie(nullptr)->sync_with_stdio(false);
cin >> n;
for(int i = 1; i<=n; ++i) cin >> arr[i];
for(int i = 1; i<=n; ++i){
ans[i] = solve(arr[i]);
ans[i]+=ans[i - 1];
}
cin >> q;
while(q--){
int x; cin >> x;
int i = lower_bound(ans+1, ans+1+n, x) - ans;
cout << arr[i] / (ans[i] - ans[i - 1]) << '\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... |