Submission #575129

# Submission time Handle Problem Language Result Execution time Memory
575129 2022-06-09T17:30:20 Z AngrySeal Intercastellar (JOI22_ho_t1) C++14
100 / 100
96 ms 10280 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin>>n;
    ll a[n];
    for (int i=0;i<n;i++) cin>>a[i];
    ll num[n],pre[n];
    for (int i=0;i<n;i++){
        num[i] = 1;
        while (a[i] % 2 == 0){
            a[i] /= 2LL;
            num[i] *= 2LL;
        }
        if (i) pre[i] = num[i] + pre[i-1];
        else pre[i] = num[i];
    }
    int q;
    cin>>q;
    while (q--){
        ll xi;
        cin>>xi;
        int l = 0, r = n-1;
        while (l != r){
            int m = (l+r)/2;
            if (xi <= pre[m]) r = m;
            else l = m + 1;
        }
        cout<<a[l]<<'\n';
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 20 ms 5456 KB Output is correct
4 Correct 31 ms 2644 KB Output is correct
5 Correct 52 ms 7052 KB Output is correct
6 Correct 29 ms 5312 KB Output is correct
7 Correct 51 ms 7116 KB Output is correct
8 Correct 56 ms 7216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 328 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 20 ms 5456 KB Output is correct
4 Correct 31 ms 2644 KB Output is correct
5 Correct 52 ms 7052 KB Output is correct
6 Correct 29 ms 5312 KB Output is correct
7 Correct 51 ms 7116 KB Output is correct
8 Correct 56 ms 7216 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 328 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 32 ms 3232 KB Output is correct
24 Correct 38 ms 6220 KB Output is correct
25 Correct 94 ms 10280 KB Output is correct
26 Correct 45 ms 6476 KB Output is correct
27 Correct 40 ms 6656 KB Output is correct
28 Correct 78 ms 10056 KB Output is correct
29 Correct 96 ms 9300 KB Output is correct
30 Correct 49 ms 4032 KB Output is correct
31 Correct 86 ms 9792 KB Output is correct