Submission #938550

#TimeUsernameProblemLanguageResultExecution timeMemory
938550the_coding_poohIntercastellar (JOI22_ho_t1)C++14
100 / 100
56 ms7636 KiB
#include <bits/stdc++.h>
#include <bits/extc++.h>
#define uwu return 0;

using namespace std;

#define fs first
#define sc second

using ll = long long;

const int SIZE = 2e5 + 5;

int N, Q;

ll arr[SIZE], x;

ll div(ll i){
    ll a = arr[i], ret = 1;
    
    while(!(a & 1)){
        a >>= 1;
        arr[i] >>= 1;
        ret <<= 1;
    }
    
    return ret;
}

int main(){
    cin.tie(0), ios::sync_with_stdio(0);
    cin >> N;
    
    for (int i = 1; i <= N;i++){
        cin >> arr[i];
    }

    cin >> Q;

    ll nttl = 0, i = 0;

    while(Q--){
        cin >> x;
        while(nttl < x){
            nttl += div(++i);
        }
        cout << arr[i] << '\n';
    }

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