답안 #997878

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
997878 2024-06-13T04:36:55 Z yanb Intercastellar (JOI22_ho_t1) C++14
100 / 100
59 ms 10940 KB
#include <bits/stdc++.h>

#define int long long

using namespace std;

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

    int n, q;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    cin >> q;

    vector<int> v2(n, 1);
    for (int i = 0; i < n; i++) {
        while (a[i] % 2 == 0) {
            a[i] /= 2;
            v2[i] *= 2;
        }
    }
    vector<int> pref(n + 1);
    for (int i = 0; i < n; i++) pref[i + 1] = pref[i] + v2[i];

    while (q--) {
        int x;
        cin >> x;
        x--;

        cout << a[upper_bound(pref.begin(), pref.end(), x) - pref.begin() - 1] << "\n";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 18 ms 5468 KB Output is correct
4 Correct 19 ms 2836 KB Output is correct
5 Correct 49 ms 7224 KB Output is correct
6 Correct 20 ms 5464 KB Output is correct
7 Correct 34 ms 7144 KB Output is correct
8 Correct 36 ms 7248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 460 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 476 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 18 ms 5468 KB Output is correct
4 Correct 19 ms 2836 KB Output is correct
5 Correct 49 ms 7224 KB Output is correct
6 Correct 20 ms 5464 KB Output is correct
7 Correct 34 ms 7144 KB Output is correct
8 Correct 36 ms 7248 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 460 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 476 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 22 ms 3280 KB Output is correct
24 Correct 23 ms 6480 KB Output is correct
25 Correct 46 ms 10328 KB Output is correct
26 Correct 31 ms 6484 KB Output is correct
27 Correct 41 ms 6736 KB Output is correct
28 Correct 55 ms 10940 KB Output is correct
29 Correct 58 ms 10312 KB Output is correct
30 Correct 25 ms 3928 KB Output is correct
31 Correct 59 ms 10836 KB Output is correct