Submission #1286725

#TimeUsernameProblemLanguageResultExecution timeMemory
1286725fzyzzz_zIntercastellar (JOI22_ho_t1)C++20
100 / 100
45 ms4552 KiB
#include <bits/stdc++.h>
using namespace std; 

using ll = long long; 

int32_t main() {
    ios_base::sync_with_stdio(false); 
    cin.tie(0); 

    int n; 
    cin >> n; 
    vector<ll> a(n); 
    for (auto & x: a) cin >> x; 

    ll have = 0; 
    int at = -1; 

    int q; 
    cin >> q; 
    while (q--) {
        ll x; 
        cin >> x; 

        while (have < x) {
            at++; 
            ll cur = 1; 
            while (a[at] % 2 == 0) {
                cur += cur; 
                a[at] /= 2; 
            }
            have += cur; 
        }

        cout << a[at] << '\n'; 
    }


}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...