답안 #789410

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
789410 2023-07-21T11:02:14 Z Andrey Intercastellar (JOI22_ho_t1) C++14
100 / 100
65 ms 9384 KB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long n,q,a,l,r,m;
    cin >> n;
    vector<long long> pr(1);
    vector<long long> haha(0);
    for(long long i = 0; i < n; i++) {
        cin >> a;
        pr.push_back(1);
        while(a%2 == 0) {
            a/=2;
            pr[i+1]*=2;
        }
        haha.push_back(a);
    }
    for(long long i = 1; i <= n; i++) {
        pr[i]+=pr[i-1];
    }
    cin >> q;
    for(long long i = 0; i < q; i++) {
        cin >> a;
        l = 0;
        r = n;
        while(l < r) {
            m = (l+r)/2;
            if(pr[m] >= a) {
                r = m;
            }
            else {
                l = m+1;
            }
        }
        cout << haha[l-1] << "\n";
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 17 ms 4200 KB Output is correct
4 Correct 25 ms 2604 KB Output is correct
5 Correct 41 ms 5776 KB Output is correct
6 Correct 25 ms 4260 KB Output is correct
7 Correct 55 ms 5668 KB Output is correct
8 Correct 50 ms 5860 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 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 320 KB Output is correct
6 Correct 1 ms 320 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 316 KB Output is correct
10 Correct 1 ms 284 KB Output is correct
11 Correct 1 ms 368 KB Output is correct
12 Correct 1 ms 336 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 1 ms 320 KB Output is correct
3 Correct 17 ms 4200 KB Output is correct
4 Correct 25 ms 2604 KB Output is correct
5 Correct 41 ms 5776 KB Output is correct
6 Correct 25 ms 4260 KB Output is correct
7 Correct 55 ms 5668 KB Output is correct
8 Correct 50 ms 5860 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 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 320 KB Output is correct
14 Correct 1 ms 320 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 316 KB Output is correct
18 Correct 1 ms 284 KB Output is correct
19 Correct 1 ms 368 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 25 ms 3288 KB Output is correct
24 Correct 29 ms 5424 KB Output is correct
25 Correct 54 ms 8996 KB Output is correct
26 Correct 36 ms 5792 KB Output is correct
27 Correct 34 ms 5732 KB Output is correct
28 Correct 63 ms 9384 KB Output is correct
29 Correct 65 ms 8936 KB Output is correct
30 Correct 31 ms 3876 KB Output is correct
31 Correct 62 ms 9288 KB Output is correct