제출 #991156

#제출 시각아이디문제언어결과실행 시간메모리
991156OtalpIntercastellar (JOI22_ho_t1)C++14
100 / 100
350 ms6996 KiB
#include<bits/stdc++.h>
using namespace std;
#define ll long long


int a[200100];

void solve(){
    int n;
    cin>>n;
    for(int i=1; i<=n; i++){
        cin>>a[i];
    }
    ll d=0;
    int t; 
    cin>>t;
    ll x = 1;
    while(t--){
        ll g;
        cin>>g;
        while(true){
            ll k = a[x];
            ll h = 1;
            while(k % 2 == 0) k /= 2, h*=2;
            if(g - d <= h){
                cout<<k<<'\n';
                break;
            }
            d += h;
            x ++;
        }
    }
}


int main(){
    solve();
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...