답안 #801085

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
801085 2023-08-02T04:30:06 Z vjudge1 Intercastellar (JOI22_ho_t1) C++17
100 / 100
68 ms 5324 KB
#ifdef Home
#define _GLIBCXX_DEBUG
#endif // Home

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

main() {
#ifdef Home
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // Home
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    ll n, q, x, y, l, r, m;
    cin >> n;
    ll pref[n + 1], num[n + 1];
    pref[0] = num[0] = 0;
    for(int i = 1; i <= n; ++ i) {
        cin >> x;
        y = __builtin_ctz(x);
        pref[i] = pref[i - 1] + (1<<y);
        num[i] =(x>>y);
    }
    for(cin >> q; q --> 0;) {
        cin >> x;
        l = 0, r = n;
        for(; l + 1 < r;) {
            m = (l + r) / 2;
            (pref[m] < x ? l : r) = m;
        }
        cout << num[r] << '\n';
    }
}

Compilation message

Main.cpp:12:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   12 | main() {
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 14 ms 3388 KB Output is correct
4 Correct 23 ms 1356 KB Output is correct
5 Correct 39 ms 3832 KB Output is correct
6 Correct 22 ms 3120 KB Output is correct
7 Correct 38 ms 3768 KB Output is correct
8 Correct 39 ms 3788 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 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 340 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 340 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 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 14 ms 3388 KB Output is correct
4 Correct 23 ms 1356 KB Output is correct
5 Correct 39 ms 3832 KB Output is correct
6 Correct 22 ms 3120 KB Output is correct
7 Correct 38 ms 3768 KB Output is correct
8 Correct 39 ms 3788 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 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 26 ms 1892 KB Output is correct
24 Correct 30 ms 3200 KB Output is correct
25 Correct 51 ms 5324 KB Output is correct
26 Correct 40 ms 2900 KB Output is correct
27 Correct 28 ms 3028 KB Output is correct
28 Correct 56 ms 4568 KB Output is correct
29 Correct 68 ms 3772 KB Output is correct
30 Correct 29 ms 1356 KB Output is correct
31 Correct 54 ms 4228 KB Output is correct