Submission #988737

# Submission time Handle Problem Language Result Execution time Memory
988737 2024-05-25T20:12:48 Z Irate Intercastellar (JOI22_ho_t1) C++17
100 / 100
67 ms 8656 KB
#include<bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int>v = {0};
    vector<long long>pref(n + 1);
    for(int i = 1;i <= n;++i){
        int a;
        cin >> a;
        int cpy = a, cnt = 1;
        while(cpy % 2 == 0){
            cpy /= 2;
        }
        cnt = a / cpy;
        v.push_back(cpy);
        pref[i] = pref[i - 1] + cnt;
    }
    int q;
    cin >> q;
    while(q--){
        long long x;
        cin >> x;
        int l = 1, r = n, ans = -1;
        while(l <= r){
            int mid = (l + r) >> 1;
            if(pref[mid] >= x){
                ans = mid;
                r = mid - 1;
            }
            else{
                l = mid + 1;
            }
        }
        cout << v[ans] << '\n';
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 20 ms 3496 KB Output is correct
4 Correct 28 ms 2320 KB Output is correct
5 Correct 42 ms 4812 KB Output is correct
6 Correct 25 ms 3544 KB Output is correct
7 Correct 42 ms 4888 KB Output is correct
8 Correct 43 ms 5140 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 20 ms 3496 KB Output is correct
4 Correct 28 ms 2320 KB Output is correct
5 Correct 42 ms 4812 KB Output is correct
6 Correct 25 ms 3544 KB Output is correct
7 Correct 42 ms 4888 KB Output is correct
8 Correct 43 ms 5140 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 2 ms 344 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 352 KB Output is correct
23 Correct 26 ms 3156 KB Output is correct
24 Correct 29 ms 4824 KB Output is correct
25 Correct 56 ms 8204 KB Output is correct
26 Correct 37 ms 5228 KB Output is correct
27 Correct 34 ms 5072 KB Output is correct
28 Correct 64 ms 8652 KB Output is correct
29 Correct 67 ms 8212 KB Output is correct
30 Correct 32 ms 3672 KB Output is correct
31 Correct 64 ms 8656 KB Output is correct