답안 #658841

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
658841 2022-11-15T03:39:46 Z GrandTiger1729 Intercastellar (JOI22_ho_t1) C++17
100 / 100
102 ms 9932 KB
#include <iostream>
#include <algorithm>
using namespace std;

int main(){
    cin.tie(0)->sync_with_stdio(0);
    int n; cin >> n;
    int a[n];
    for (int i = 0; i < n; i++){
        cin >> a[i];
    }
    long long res[n]{}, pref[n + 1]{};
    for (int i = 0; i < n; i++){
        res[i] = 1;
        while (a[i] % 2 == 0){
            res[i] *= 2;
            a[i] /= 2;
        }
        pref[i + 1] = pref[i] + res[i];
    }
    int q; cin >> q;
    while (q--){
        long long x; cin >> x;
        int i = lower_bound(pref, pref + n + 1, x) - pref - 1;
        cout << a[i] << '\n';
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 22 ms 4716 KB Output is correct
4 Correct 37 ms 2540 KB Output is correct
5 Correct 52 ms 6320 KB Output is correct
6 Correct 39 ms 4660 KB Output is correct
7 Correct 52 ms 6316 KB Output is correct
8 Correct 53 ms 6416 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 320 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 328 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 340 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 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 22 ms 4716 KB Output is correct
4 Correct 37 ms 2540 KB Output is correct
5 Correct 52 ms 6320 KB Output is correct
6 Correct 39 ms 4660 KB Output is correct
7 Correct 52 ms 6316 KB Output is correct
8 Correct 53 ms 6416 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 320 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 328 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 212 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 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 27 ms 3160 KB Output is correct
24 Correct 35 ms 5708 KB Output is correct
25 Correct 74 ms 9548 KB Output is correct
26 Correct 49 ms 6068 KB Output is correct
27 Correct 41 ms 6088 KB Output is correct
28 Correct 102 ms 9932 KB Output is correct
29 Correct 80 ms 9384 KB Output is correct
30 Correct 42 ms 3816 KB Output is correct
31 Correct 82 ms 9904 KB Output is correct