Submission #734772

# Submission time Handle Problem Language Result Execution time Memory
734772 2023-05-03T05:03:53 Z rahidilbayramli Intercastellar (JOI22_ho_t1) C++17
100 / 100
497 ms 10388 KB
#include<bits/stdc++.h>
#define ll long long
#define vl vector<ll>
#define sl set<ll>
#define all(v) v.begin(), v.end()
#define pb push_back
#define s second
#define f first
#define pll pair<ll, ll>
#define pii pair<int, int>
using namespace std;
int main()
{
    ll n, i, k, p, x, q;
    cin >> n;
    vl v(n);
    for(ll&h : v)    cin >> h;
    vector<pair<ll, ll>>v1;
    for(i = 0; i < n; i++)
    {
        p = v[i];
        k = 1;
        while(p % 2 == 0)
        {
            p /= 2;
            k *= 2;
        }
        if(v1.empty())    v1.pb({k, p});
        else    v1.pb({k+v1.back().f, p});
    }
    cin >> q;
    while(q--)
    {
        cin >> x;
        cout << (*lower_bound(all(v1), pair<ll, ll>{x, 0})).s << "\n";
    }
}
# 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 94 ms 6544 KB Output is correct
4 Correct 260 ms 2844 KB Output is correct
5 Correct 347 ms 7232 KB Output is correct
6 Correct 220 ms 6316 KB Output is correct
7 Correct 356 ms 7192 KB Output is correct
8 Correct 410 ms 7240 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 296 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 3 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 3 ms 340 KB Output is correct
12 Correct 3 ms 340 KB Output is correct
13 Correct 1 ms 308 KB Output is correct
14 Correct 3 ms 368 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 94 ms 6544 KB Output is correct
4 Correct 260 ms 2844 KB Output is correct
5 Correct 347 ms 7232 KB Output is correct
6 Correct 220 ms 6316 KB Output is correct
7 Correct 356 ms 7192 KB Output is correct
8 Correct 410 ms 7240 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 296 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 300 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 3 ms 340 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 3 ms 340 KB Output is correct
20 Correct 3 ms 340 KB Output is correct
21 Correct 1 ms 308 KB Output is correct
22 Correct 3 ms 368 KB Output is correct
23 Correct 222 ms 3344 KB Output is correct
24 Correct 195 ms 7124 KB Output is correct
25 Correct 497 ms 10388 KB Output is correct
26 Correct 251 ms 6700 KB Output is correct
27 Correct 267 ms 7136 KB Output is correct
28 Correct 439 ms 10036 KB Output is correct
29 Correct 454 ms 9160 KB Output is correct
30 Correct 334 ms 4136 KB Output is correct
31 Correct 492 ms 9680 KB Output is correct