답안 #936128

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
936128 2024-03-01T07:46:56 Z weakweakweak Intercastellar (JOI22_ho_t1) C++14
100 / 100
68 ms 12628 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
ll a[310000] = {0}, cnt[310000] = {0}, pre[310000] = {0};

int main () {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, q, x;
    vector <int> v;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        cnt[i] = 1;
        while (a[i] % 2 == 0) {
            a[i] >>= 1;
            cnt[i] <<= 1;
        }
    }
    
    for (int i = 1; i <= n; i++) pre[i] = pre[i - 1] + cnt[i];
    ll y;
    cin >> q;
    while (q--) {
        cin >> y;
        int ii = lower_bound(pre + 1, pre + 1 + n, y) - pre;
        cout << a[ii] << '\n'; 
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:9:15: warning: unused variable 'x' [-Wunused-variable]
    9 |     int n, q, x;
      |               ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4440 KB Output is correct
3 Correct 16 ms 6876 KB Output is correct
4 Correct 27 ms 7204 KB Output is correct
5 Correct 43 ms 7252 KB Output is correct
6 Correct 24 ms 6744 KB Output is correct
7 Correct 40 ms 7260 KB Output is correct
8 Correct 40 ms 7248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4440 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4696 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4440 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4440 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4440 KB Output is correct
3 Correct 16 ms 6876 KB Output is correct
4 Correct 27 ms 7204 KB Output is correct
5 Correct 43 ms 7252 KB Output is correct
6 Correct 24 ms 6744 KB Output is correct
7 Correct 40 ms 7260 KB Output is correct
8 Correct 40 ms 7248 KB Output is correct
9 Correct 1 ms 4440 KB Output is correct
10 Correct 1 ms 4440 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4696 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4440 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4440 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 1 ms 4444 KB Output is correct
22 Correct 1 ms 4440 KB Output is correct
23 Correct 24 ms 8788 KB Output is correct
24 Correct 28 ms 9308 KB Output is correct
25 Correct 54 ms 12116 KB Output is correct
26 Correct 34 ms 10064 KB Output is correct
27 Correct 33 ms 9828 KB Output is correct
28 Correct 59 ms 12628 KB Output is correct
29 Correct 57 ms 12140 KB Output is correct
30 Correct 33 ms 9700 KB Output is correct
31 Correct 68 ms 12548 KB Output is correct