제출 #528115

#제출 시각아이디문제언어결과실행 시간메모리
528115dooweyIntercastellar (JOI22_ho_t1)C++14
100 / 100
78 ms8836 KiB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = (int)2e5 + 10;
ll A[N];
ll C[N];

int main(){
    fastIO;
    //freopen("in.txt","r",stdin);
    int n;
    cin >> n;
    for(int i = 1; i <= n; i ++ ){
        cin >> A[i];
        C[i] = 1;
        while(A[i] % 2 == 0){
            A[i] /= 2;
            C[i] *= 2ll;
        }
    }
    int q;
    cin >> q;
    ll X;
    int id = 0;
    ll cum = 0;
    for(int i = 1; i <= q; i ++ ){
        cin >> X;
        while(cum + C[id + 1] < X){
            cum += C[id + 1];
            id ++ ;
        }
        cout << A[id + 1] << "\n";
    }
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...