Submission #727239

# Submission time Handle Problem Language Result Execution time Memory
727239 2023-04-20T09:32:36 Z khanhdz06 Intercastellar (JOI22_ho_t1) C++17
100 / 100
86 ms 10796 KB
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pl;
const ll mxn=200002;
ll n;
ll a[mxn];
ll val[mxn];
ll c[mxn];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>n;
    for(ll i=1;i<=n;i++)
        cin>>a[i];
    for(ll i=1;i<=n;i++)
    {
        ll k=a[i];
        while(a[i]%2==0)
            a[i]/=2;
        val[i]=a[i];
        c[i]=k/a[i];
        c[i]+=c[i-1];
    }
    ll q;
    cin>>q;
    while(q--)
    {
        ll x;
        cin>>x;
        ll h=lower_bound(c+1,c+n+1,x)-c;
        cout<<val[h]<<'\n';
    }
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 28 ms 5488 KB Output is correct
4 Correct 32 ms 2648 KB Output is correct
5 Correct 54 ms 7044 KB Output is correct
6 Correct 31 ms 5324 KB Output is correct
7 Correct 56 ms 7136 KB Output is correct
8 Correct 53 ms 7172 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 332 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 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 368 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 28 ms 5488 KB Output is correct
4 Correct 32 ms 2648 KB Output is correct
5 Correct 54 ms 7044 KB Output is correct
6 Correct 31 ms 5324 KB Output is correct
7 Correct 56 ms 7136 KB Output is correct
8 Correct 53 ms 7172 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 328 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 332 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 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 368 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 372 KB Output is correct
23 Correct 30 ms 3272 KB Output is correct
24 Correct 35 ms 6308 KB Output is correct
25 Correct 69 ms 10392 KB Output is correct
26 Correct 46 ms 6604 KB Output is correct
27 Correct 50 ms 6664 KB Output is correct
28 Correct 81 ms 10796 KB Output is correct
29 Correct 86 ms 10188 KB Output is correct
30 Correct 49 ms 3920 KB Output is correct
31 Correct 84 ms 10756 KB Output is correct