Submission #921064

# Submission time Handle Problem Language Result Execution time Memory
921064 2024-02-03T09:32:24 Z AnasAAF Intercastellar (JOI22_ho_t1) C++14
100 / 100
75 ms 11068 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define float double

int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;cin>>n;
    vector<ll>v(n);for(int i=0;i<n;i++)cin>>v[i];
    vector<pair<ll, ll>>vp;
    for(int i=0;i<n;i++){
        ll cnt(1);
        ll x = v[i];
        while(x%2==0){
            cnt*=2;
            x/=2;
        }
        vp.push_back({cnt, x});
    }
    vector<ll>pr(n+1);
    for(int i=1;i<=n;i++)pr[i] = pr[i-1] + vp[i-1].first;

    //for(int i=0;i<n;i++)cout<<vp[i].first<<" : "<<vp[i].second<<endl;

    int Q;cin>>Q;
    while(Q--){
        ll x;cin>>x;
        auto it = lower_bound(pr.begin(), pr.end(), x);
        cout<<vp[it-pr.begin()-1].second<<endl;
    }

    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 19 ms 7420 KB Output is correct
4 Correct 24 ms 3024 KB Output is correct
5 Correct 53 ms 8136 KB Output is correct
6 Correct 26 ms 7892 KB Output is correct
7 Correct 43 ms 8132 KB Output is correct
8 Correct 44 ms 9168 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 0 ms 348 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 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 456 KB Output is correct
10 Correct 0 ms 348 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
# 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 19 ms 7420 KB Output is correct
4 Correct 24 ms 3024 KB Output is correct
5 Correct 53 ms 8136 KB Output is correct
6 Correct 26 ms 7892 KB Output is correct
7 Correct 43 ms 8132 KB Output is correct
8 Correct 44 ms 9168 KB Output is correct
9 Correct 0 ms 344 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 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 456 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 23 ms 3292 KB Output is correct
24 Correct 30 ms 8660 KB Output is correct
25 Correct 55 ms 11068 KB Output is correct
26 Correct 44 ms 6348 KB Output is correct
27 Correct 35 ms 9160 KB Output is correct
28 Correct 62 ms 10840 KB Output is correct
29 Correct 75 ms 9928 KB Output is correct
30 Correct 34 ms 3336 KB Output is correct
31 Correct 62 ms 10428 KB Output is correct