답안 #734359

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
734359 2023-05-02T10:12:46 Z Josia Intercastellar (JOI22_ho_t1) C++17
100 / 100
90 ms 10856 KB
#include <bits/stdc++.h>

using namespace std;

#define int int64_t


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


    int n; cin >> n;
    vector<int> a(n);

    for (int i = 0; i<n; i++) {
        cin >> a[i];
    }


    vector<pair<int, int>> pieces;  // amount, len


    for (int i=0; i<n; i++) {
        int len = a[i];
        int amount = 1;

        while (len%2==0) {
            len = len/2;
            amount *= 2;
        }
        if (pieces.empty()) pieces.push_back({amount, len});
        else pieces.push_back({amount+pieces.back().first, len});
    }


    int q; cin >> q;

    for (int i = 0; i<q; i++) {
        int x; cin >> x;

        cout << (*lower_bound(pieces.begin(), pieces.end(), pair<int, int>{x, 0})).second << "\n";
    }





    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 28 ms 6680 KB Output is correct
4 Correct 36 ms 2876 KB Output is correct
5 Correct 55 ms 7168 KB Output is correct
6 Correct 32 ms 6348 KB Output is correct
7 Correct 63 ms 7180 KB Output is correct
8 Correct 53 ms 7332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 276 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 320 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 28 ms 6680 KB Output is correct
4 Correct 36 ms 2876 KB Output is correct
5 Correct 55 ms 7168 KB Output is correct
6 Correct 32 ms 6348 KB Output is correct
7 Correct 63 ms 7180 KB Output is correct
8 Correct 53 ms 7332 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 276 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 320 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 332 KB Output is correct
23 Correct 30 ms 3444 KB Output is correct
24 Correct 38 ms 7108 KB Output is correct
25 Correct 73 ms 10472 KB Output is correct
26 Correct 50 ms 6696 KB Output is correct
27 Correct 47 ms 7304 KB Output is correct
28 Correct 85 ms 10856 KB Output is correct
29 Correct 90 ms 10424 KB Output is correct
30 Correct 43 ms 4020 KB Output is correct
31 Correct 79 ms 10816 KB Output is correct