답안 #534076

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
534076 2022-03-08T00:29:32 Z 183234 Intercastellar (JOI22_ho_t1) C++14
100 / 100
302 ms 8436 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long int
/*
int log(int a, int n){
    if(n < a)
        return 0;
    return log(n/a)+1;
}
int fac(int n){
    if(n < 1)
        return 1;
    return n * fac(n-1);
}*/

int a[200000];
int b[200000];
int pre[200010];
int q[200000];

int32_t main(){
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    int Q;
    cin >> Q;
    for(int i = 0; i < Q; i++){
        cin >> q[i];
    }
    for(int i = 0; i < n; i++){
        b[i] = 1;
    }
    for(int i = 0; i < n; i++){
        while(a[i] % 2 == 0){
            b[i] *= 2;
            a[i] /= 2;
        }
        //cout << "suichan " << i << ' ' << a[i] << ' ' << b[i] <<'\n';
    }
    pre[0] = 0;
    for(int i = 0; i < n; i++){
        pre[i+1] = pre[i]+b[i];
    }
    for(int i = 0; i < Q; i++){
        cout << a[(lower_bound(pre, pre+n+1, q[i])-pre)-1] << '\n';
    }


    


    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 47 ms 5104 KB Output is correct
4 Correct 83 ms 2880 KB Output is correct
5 Correct 122 ms 6880 KB Output is correct
6 Correct 71 ms 5136 KB Output is correct
7 Correct 150 ms 7040 KB Output is correct
8 Correct 151 ms 6828 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 6 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 11 ms 332 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 2 ms 332 KB Output is correct
12 Correct 14 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 2 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 47 ms 5104 KB Output is correct
4 Correct 83 ms 2880 KB Output is correct
5 Correct 122 ms 6880 KB Output is correct
6 Correct 71 ms 5136 KB Output is correct
7 Correct 150 ms 7040 KB Output is correct
8 Correct 151 ms 6828 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 6 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 11 ms 332 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 2 ms 332 KB Output is correct
20 Correct 14 ms 332 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 2 ms 332 KB Output is correct
23 Correct 67 ms 3096 KB Output is correct
24 Correct 107 ms 4940 KB Output is correct
25 Correct 168 ms 8436 KB Output is correct
26 Correct 136 ms 4672 KB Output is correct
27 Correct 120 ms 4720 KB Output is correct
28 Correct 210 ms 7628 KB Output is correct
29 Correct 241 ms 7008 KB Output is correct
30 Correct 139 ms 2892 KB Output is correct
31 Correct 302 ms 7568 KB Output is correct