제출 #575101

#제출 시각아이디문제언어결과실행 시간메모리
575101dariascIntercastellar (JOI22_ho_t1)C++14
100 / 100
331 ms9216 KiB
#include <bits/stdc++.h>
using namespace std;
 
#pragma region header
typedef long long ll;
template <typename Value>
using vec = vector<Value>;
istream &in = cin;
ostream &out = cout;
#define all(x) x.begin(), x.end()
#define fast() cin.tie(0); ios_base::sync_with_stdio(0)
#pragma endregion

void solve()
{
    int n; in >> n;
    vec<int> a(n);
    for (int i = 0; i < n; i++) {
        in >> a[i];
    }
    vec<int> sz(n);
    for (int i = 0; i < n; i++) {
        int c = 1;
        int x = a[i];
        while (x % 2 == 0) {
            x /= 2;
            c *= 2;
        }
        sz[i] = c;
    }
    vec<long long> pfx(n, 0);
    pfx[0] = sz[0];
    for (int i = 1; i < n; i++) {
        pfx[i] = sz[i] + pfx[i-1];
    }

    int q; in >> q;
    while (q--) {
        long long x; in >> x;
        int i = lower_bound(all(pfx), x) - pfx.begin();
        
        int o = a[i];
        while (o % 2 == 0) {
            o /= 2;
        }
        out << o << endl;
    }
}

int main()
{
    fast();
    solve(); return 0;
    int t; in >> t;
    while (t--) {
        solve();
    }
}

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp:4: warning: ignoring '#pragma region header' [-Wunknown-pragmas]
    4 | #pragma region header
      | 
Main.cpp:12: warning: ignoring '#pragma endregion ' [-Wunknown-pragmas]
   12 | #pragma endregion
      |
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...