Submission #862224

# Submission time Handle Problem Language Result Execution time Memory
862224 2023-10-17T18:47:30 Z arbuzick Intercastellar (JOI22_ho_t1) C++17
100 / 100
91 ms 10068 KB
#include <bits/stdc++.h>

using namespace std;

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<pair<int, int>> b(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        int pw = 0;
        while (a[i] % (1 << (pw + 1)) == 0) {
            pw++;
        }
        b[i] = {1 << pw, a[i] / (1 << pw)};
    }
    vector<long long> pr_cnt(n + 1);
    for (int i = 0; i < n; ++i) {
        pr_cnt[i + 1] = pr_cnt[i] + b[i].first;
    }
    int q;
    cin >> q;
    while (q--) {
        long long x;
        cin >> x;
        x--;
        int pos = upper_bound(pr_cnt.begin(), pr_cnt.end(), x) - pr_cnt.begin() - 1;
        cout << b[pos].second << '\n';
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 17 ms 4184 KB Output is correct
4 Correct 24 ms 1628 KB Output is correct
5 Correct 41 ms 4688 KB Output is correct
6 Correct 25 ms 3920 KB Output is correct
7 Correct 44 ms 4688 KB Output is correct
8 Correct 41 ms 4696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 424 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 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 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 17 ms 4184 KB Output is correct
4 Correct 24 ms 1628 KB Output is correct
5 Correct 41 ms 4688 KB Output is correct
6 Correct 25 ms 3920 KB Output is correct
7 Correct 44 ms 4688 KB Output is correct
8 Correct 41 ms 4696 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 424 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 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 344 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 504 KB Output is correct
23 Correct 23 ms 3156 KB Output is correct
24 Correct 29 ms 5712 KB Output is correct
25 Correct 62 ms 9484 KB Output is correct
26 Correct 47 ms 6224 KB Output is correct
27 Correct 46 ms 6124 KB Output is correct
28 Correct 79 ms 10068 KB Output is correct
29 Correct 91 ms 9460 KB Output is correct
30 Correct 34 ms 3948 KB Output is correct
31 Correct 84 ms 10052 KB Output is correct