Submission #1325068

#TimeUsernameProblemLanguageResultExecution timeMemory
1325068zwezdinvIntercastellar (JOI22_ho_t1)C++20
100 / 100
53 ms5348 KiB
#include<bits/stdc++.h>

using ll = long long;

signed main() {
    std::cin.tie(nullptr)->sync_with_stdio(false);

    int n;
    std::cin >> n;
    std::vector<ll> a(n);
    std::vector<ll> pref(n + 1);
    for (auto& i : a) std::cin >> i;
    for (int i = 0; i < n; ++i) {
        int k = __builtin_ctzll(a[i]);
        a[i] >>= k;
        pref[i + 1] = pref[i] + (1ll << k);
    }
    int q;
    std::cin >> q;
    while (q--) {
        ll x;
        std::cin >> x;
        int k = std::lower_bound(pref.begin(), pref.end(), x) - pref.begin();
        std::cout << a[k - 1] << '\n';
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...