Submission #686753

# Submission time Handle Problem Language Result Execution time Memory
686753 2023-01-25T22:33:10 Z yaufung Intercastellar (JOI22_ho_t1) C++17
100 / 100
74 ms 9960 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int q;
    cin >> q;
    vector<long long> b(q);
    for (int i = 0; i < q; i++) {
        cin >> b[i];
    }
    vector<int> num(n);
    vector<int> ct(n);
    for (int i = 0; i < n; i++) {
        int c = 1;
        int x = a[i];
        while (x % 2 == 0) {
            c *= 2;
            x /= 2;
        }
        num[i] = x;
        ct[i] = c;
    }
    int p = 0;
    long long sum = 0;
    for (int i = 0; i < q; i++) {
        while (sum + ct[p] < b[i]) {
            sum += ct[p];
            p++;
        }
        cout << num[p] << "\n";
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 20 ms 3500 KB Output is correct
4 Correct 26 ms 3268 KB Output is correct
5 Correct 42 ms 6248 KB Output is correct
6 Correct 24 ms 4172 KB Output is correct
7 Correct 42 ms 6348 KB Output is correct
8 Correct 42 ms 6376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 320 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 328 KB Output is correct
7 Correct 1 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 344 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 20 ms 3500 KB Output is correct
4 Correct 26 ms 3268 KB Output is correct
5 Correct 42 ms 6248 KB Output is correct
6 Correct 24 ms 4172 KB Output is correct
7 Correct 42 ms 6348 KB Output is correct
8 Correct 42 ms 6376 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 320 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 328 KB Output is correct
15 Correct 1 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 344 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 0 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 23 ms 3876 KB Output is correct
24 Correct 31 ms 5236 KB Output is correct
25 Correct 58 ms 9544 KB Output is correct
26 Correct 46 ms 5872 KB Output is correct
27 Correct 38 ms 5604 KB Output is correct
28 Correct 74 ms 9948 KB Output is correct
29 Correct 74 ms 9420 KB Output is correct
30 Correct 35 ms 4816 KB Output is correct
31 Correct 71 ms 9960 KB Output is correct