답안 #980848

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
980848 2024-05-12T13:49:35 Z LOLOLO Intercastellar (JOI22_ho_t1) C++17
100 / 100
85 ms 9492 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
#define           f     first
#define           s     second
#define           pb    push_back
#define           ep    emplace
#define           eb    emplace_back
#define           lb    lower_bound
#define           ub    upper_bound
#define       all(x)    x.begin(), x.end()
#define      rall(x)    x.rbegin(), x.rend()
#define   uniquev(v)    sort(all(v)), (v).resize(unique(all(v)) - (v).begin())
#define     mem(f,x)    memset(f , x , sizeof(f))
#define        sz(x)    (int)(x).size()
#define  __lcm(a, b)    (1ll * ((a) / __gcd((a), (b))) * (b))
#define          mxx    *max_element
#define          mnn    *min_element
#define    cntbit(x)    __builtin_popcountll(x)
#define       len(x)    (int)(x.length())
 
const int N = 2e5 + 10;
ll a[N], p[N];

void solve() {
    int n;
    cin >> n;

    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        ll t = 1;
        while (a[i] % ((ll)2 * t) == 0) {
            t = (t + t);
        }

        a[i] /= t;
        p[i] = t;
        p[i] = p[i - 1] + t;
    }

    int q;
    cin >> q;
    int j = 1;
    for (int i = 0; i < q; i++) {
        ll x;
        cin >> x;
        while (p[j] < x) {
            j++;
        }

        cout << a[j] << "\n";
    }
}

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

    int t = 1;
    //cin >> t;

    while (t--) {
        solve();
    }

    return 0;
}  
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 15 ms 4188 KB Output is correct
4 Correct 20 ms 3884 KB Output is correct
5 Correct 35 ms 5592 KB Output is correct
6 Correct 21 ms 4488 KB Output is correct
7 Correct 36 ms 5576 KB Output is correct
8 Correct 35 ms 5716 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2648 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 15 ms 4188 KB Output is correct
4 Correct 20 ms 3884 KB Output is correct
5 Correct 35 ms 5592 KB Output is correct
6 Correct 21 ms 4488 KB Output is correct
7 Correct 36 ms 5576 KB Output is correct
8 Correct 35 ms 5716 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2648 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2392 KB Output is correct
23 Correct 19 ms 4952 KB Output is correct
24 Correct 30 ms 5704 KB Output is correct
25 Correct 49 ms 8804 KB Output is correct
26 Correct 43 ms 6224 KB Output is correct
27 Correct 43 ms 6132 KB Output is correct
28 Correct 73 ms 9296 KB Output is correct
29 Correct 85 ms 8788 KB Output is correct
30 Correct 31 ms 5724 KB Output is correct
31 Correct 80 ms 9492 KB Output is correct