Submission #636486

# Submission time Handle Problem Language Result Execution time Memory
636486 2022-08-29T10:54:32 Z danikoynov Intercastellar (JOI22_ho_t1) C++14
35 / 100
7 ms 2256 KB
/**
 ____ ____ ____ ____ ____ ____
||l |||e |||i |||n |||a |||d ||
||__|||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|/__\|

**/

#include<bits/stdc++.h>
#define endl '\n'

using namespace std;
typedef long long ll;

void speed()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
const int maxn = 1e5 + 10;

int n, q;
ll a[maxn], pref[maxn];
void solve()
{
    cin >> n;
    for (int i = 1; i <= n; i ++)
    {
        cin >> a[i];
        ll bit = 0;
        while(a[i] % (1 << bit) == 0)
            bit ++;
        bit --;
        pref[i] = pref[i - 1] + (1 << bit);
        a[i] /= (1 << bit);
    }

    cin >> q;
    for (int i = 1; i <= q; i ++)
    {
        int l = 0, r = n;
        ll x;
        cin >> x;
        while(l <= r)
        {
            int m = (l + r) / 2;
            if (pref[m] < x)
                l = m + 1;
            else
                r = m - 1;
        }
        cout << a[l] << endl;
    }

}

int main()
{
    speed();
    solve();
    return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 7 ms 2256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 328 KB Output is correct
5 Correct 0 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 332 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 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 7 ms 2256 KB Output isn't correct
4 Halted 0 ms 0 KB -