답안 #1018583

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1018583 2024-07-10T07:11:55 Z toast12 Intercastellar (JOI22_ho_t1) C++14
100 / 100
57 ms 9420 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long

ll divide(ll x) {
    ll res = 1;
    if (x % 2 == 0)
        res = 2*divide(x/2);
    return res;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<ll> nums(n);
    for (int i = 0; i < n; i++) {
        cin >> nums[i];
    }
    vector<ll> ps;
    ll prev = 0;
    for (int i = 0; i < n; i++) {
        ps.push_back(prev+divide(nums[i]));
        prev = ps.back();
    }
    int q;
    cin >> q;
    while (q--) {
        ll x;
        cin >> x;
        auto it = lower_bound(ps.begin(), ps.end(), x);
        int idx = it-ps.begin();
        ll sz = nums[idx];
        while (sz % 2 == 0)
            sz /= 2;
        cout << sz << '\n';
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 16 ms 4568 KB Output is correct
4 Correct 20 ms 2608 KB Output is correct
5 Correct 37 ms 5576 KB Output is correct
6 Correct 24 ms 4312 KB Output is correct
7 Correct 36 ms 5832 KB Output is correct
8 Correct 34 ms 5840 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 376 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 504 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 16 ms 4568 KB Output is correct
4 Correct 20 ms 2608 KB Output is correct
5 Correct 37 ms 5576 KB Output is correct
6 Correct 24 ms 4312 KB Output is correct
7 Correct 36 ms 5832 KB Output is correct
8 Correct 34 ms 5840 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 376 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 504 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 604 KB Output is correct
23 Correct 20 ms 3292 KB Output is correct
24 Correct 25 ms 5384 KB Output is correct
25 Correct 48 ms 9000 KB Output is correct
26 Correct 35 ms 5680 KB Output is correct
27 Correct 31 ms 5648 KB Output is correct
28 Correct 55 ms 9420 KB Output is correct
29 Correct 54 ms 8908 KB Output is correct
30 Correct 27 ms 4012 KB Output is correct
31 Correct 57 ms 9276 KB Output is correct