제출 #1336115

#제출 시각아이디문제언어결과실행 시간메모리
1336115iamhereforfunIntercastellar (JOI22_ho_t1)C++20
100 / 100
62 ms6996 KiB
// Starcraft 2 enjoyer //

#include <bits/stdc++.h>

// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")

using namespace std;

#define LSOne(X) ((X) & -(X))
#define int long long

const int N = 2e5 + 5;
const int M = 1e6 + 5;
const int K = 1e3 + 5;
const int LG = 20;
const int INF = 1e18 + 5;
const int B = 1000;
const int MOD = 1e9 + 7;

int n, a[N], q, last;
vector<pair<int, int>> v;

inline void solve()
{
    cin >> n;
    last = 0;
    for (int x = 0; x < n; x++)
    {
        cin >> a[x];
        int i = a[x], c = 1;
        while (i % 2 == 0)
        {
            i /= 2;
            c *= 2;
        }
        v.push_back({c + last, i});
        last += c;
    }
    cin >> q;
    for (int x = 0; x < q; x++)
    {
        int i;
        cin >> i;
        auto it = lower_bound(v.begin(), v.end(), pair<int, int>{i, 0});
        cout << it->second << "\n";
    }
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    // cin >> t;
    for (int x = 1; x <= t; x++)
    {
        solve();
    }
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...