Submission #831398

#TimeUsernameProblemLanguageResultExecution timeMemory
831398jasminIntercastellar (JOI22_ho_t1)C++17
100 / 100
58 ms7576 KiB
//JOI 2022 Final Round
#include<bits/stdc++.h>
using namespace std;
#define int long long

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

    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }

    int q;
    cin >> q;

    int cnt=0;
    int length=0;
    int j=0;

    for(int i=0; i<q; i++){
        int x;
        cin >> x;

        while(cnt<x){

            int anz=1;
            while(a[j]%2==0){
                anz*=2;
                a[j]/=2;
            }

            cnt+=anz;
            length=a[j];
            j++;
        }

        cout << length << "\n";
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...