답안 #981115

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
981115 2024-05-12T20:21:57 Z UltraFalcon Intercastellar (JOI22_ho_t1) C++17
100 / 100
65 ms 12380 KB
#ifndef DEBUG
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2,abm,mmx,fma,popcnt")
#endif

#include <bits/stdc++.h>
#define int long long
using ll = long long;

using namespace std;

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

    int n; cin >> n;

    vector<int> a(n);
    for (auto &x : a) cin >> x;

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

    int q; cin >> q;

    vector<int> query(q);
    for (auto &x : query) cin >> x;

    for (auto &x : query) {
        int l = -1, r = n-1;
        while (r-l > 1) {
            int m = (l+r)/2;
            if (x>pref[m+1]) l=m;
            else r=m;
        }
        cout << len[r] << "\n";
    }

}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 17 ms 5980 KB Output is correct
4 Correct 33 ms 4080 KB Output is correct
5 Correct 46 ms 8788 KB Output is correct
6 Correct 29 ms 6224 KB Output is correct
7 Correct 47 ms 8784 KB Output is correct
8 Correct 46 ms 8856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 460 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 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 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 17 ms 5980 KB Output is correct
4 Correct 33 ms 4080 KB Output is correct
5 Correct 46 ms 8788 KB Output is correct
6 Correct 29 ms 6224 KB Output is correct
7 Correct 47 ms 8784 KB Output is correct
8 Correct 46 ms 8856 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 460 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 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 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 26 ms 4188 KB Output is correct
24 Correct 29 ms 7004 KB Output is correct
25 Correct 57 ms 11888 KB Output is correct
26 Correct 37 ms 7456 KB Output is correct
27 Correct 32 ms 7504 KB Output is correct
28 Correct 65 ms 12380 KB Output is correct
29 Correct 65 ms 11944 KB Output is correct
30 Correct 35 ms 5204 KB Output is correct
31 Correct 64 ms 12376 KB Output is correct