Submission #1011942

# Submission time Handle Problem Language Result Execution time Memory
1011942 2024-07-01T11:27:28 Z kaopj Intercastellar (JOI22_ho_t1) C++17
100 / 100
53 ms 9404 KB
#include <iostream>
#include <vector>
#define int long long
#define lgm cin.tie(0)->sync_with_stdio(0);
using namespace std;
signed main() {
    lgm;
    int n,x;
    cin >> n;
    vector<int> idx={0};
    vector<int> val={0};
    for (int i=0;i<n;i++) {
        cin >> x;
        int cnt=0;
        while (x%2==0) {
            x/=2;
            cnt++;
        }
        idx.push_back(idx.back()+(1<<cnt));
        val.push_back(x);
    }
    int q;
    cin >> q;
    while (q--) {
        cin >> x;
        int l=1,r=n,m;
        while (l<r) {
            m=(l+r)>>1;
            if (idx[m] >= x) {
                r=m;
            } else {
                l=m+1;
            }
        }
        cout << val[l] << '\n';
    }
}
# 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 12 ms 4272 KB Output is correct
4 Correct 17 ms 2512 KB Output is correct
5 Correct 31 ms 5820 KB Output is correct
6 Correct 21 ms 4276 KB Output is correct
7 Correct 31 ms 5816 KB Output is correct
8 Correct 31 ms 5812 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 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 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 404 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 12 ms 4272 KB Output is correct
4 Correct 17 ms 2512 KB Output is correct
5 Correct 31 ms 5820 KB Output is correct
6 Correct 21 ms 4276 KB Output is correct
7 Correct 31 ms 5816 KB Output is correct
8 Correct 31 ms 5812 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 604 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 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 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 404 KB Output is correct
23 Correct 16 ms 3284 KB Output is correct
24 Correct 21 ms 5496 KB Output is correct
25 Correct 45 ms 9028 KB Output is correct
26 Correct 31 ms 5820 KB Output is correct
27 Correct 29 ms 5816 KB Output is correct
28 Correct 53 ms 9392 KB Output is correct
29 Correct 50 ms 8880 KB Output is correct
30 Correct 26 ms 4048 KB Output is correct
31 Correct 50 ms 9404 KB Output is correct