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;
void solve()
{
    int n;
    cin >> n;
    vector<int> v(n);
    for (int &i : v)
        cin >> i;
    
    vector<int> a = v, b(n, 1);
    for (int i = 0; i < n; ++i)
        while (a[i] % 2 == 0)
            b[i] *= 2, a[i] /= 2;
    
    for (int i = 1; i < n; ++i)
        b[i] += b[i - 1];
    int q;
    cin >> q;
    while (q--)
    {
        int x;
        cin >> x;
        int id = lower_bound(b.begin(), b.end(), x) - b.begin();
        cout << a[id] << '\n';
    }
}
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    solve();
    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... |