제출 #1350076

#제출 시각아이디문제언어결과실행 시간메모리
1350076guardianecIntercastellar (JOI22_ho_t1)C++20
25 / 100
515 ms589824 KiB
#include <bits/stdc++.h>
#define ll long long
using namespace std;

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

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

    vector<ll> res;

    for (int i=n-1; i>=0; i--) {
        ll m = a[i];
        ll k = 1;
        while(m%2==0) {
            m/=2; 
            k*=2;
        }
        while(k) {
            k--;
            res.push_back(m);
        }
    }

    reverse(res.begin(), res.end());

    ll q;
    cin >> q;

    while(q--) {
        ll x;
        cin >> x;
        cout << res[x-1] << "\n";
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...