제출 #1356179

#제출 시각아이디문제언어결과실행 시간메모리
1356179gayIntercastellar (JOI22_ho_t1)C++20
100 / 100
36 ms5556 KiB
#include <bits/stdc++.h>
#include <experimental/random>
#include <random>

//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;

using namespace std;

using ld = long double;
using ll = long long;

const ll INF = 1e18, MOD = 1e9 + 7;

void solve();

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    int q = 1;
    //cin >> q;
    while (q--) {
        solve();
    }
}

void solve() {
    ll n; cin >> n;
    vector<pair<ll, ll>> a;
    for (int i = 0; i < n; i++) {
        ll x; cin >> x;
        ll cnt = 1;
        while (x % 2 == 0) {
            x /= 2; cnt *= 2;
        }
        a.emplace_back(x, cnt);
    }
    ll id = 0, cnt = 0;
    ll q; cin >> q;
    while (q--) {
        ll x; cin >> x;
        while (cnt < x) {
            cnt += a[id++].second;
        }
        cout << a[id - 1].first << '\n';
    }
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…