답안 #612293

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
612293 2022-07-29T12:43:21 Z boris_mihov Intercastellar (JOI22_ho_t1) C++14
25 / 100
66 ms 4884 KB
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>

typedef long long llong;
const int MAXN = 200000 + 10;

int a[MAXN], n, q;
llong prefix[MAXN];

void solve()
{
    for (int i = 1 ; i <= n ; ++i)
    {
        prefix[i] = prefix[i-1] + (a[i] & -a[i]);
    }

    int ptr = 1, x;
    for (int i = 1 ; i <= q ; ++i)
    {
        std::cin >> x;
        while (prefix[ptr] <= x-1) ++ptr;
        std::cout << a[ptr] / (a[ptr] & -(a[ptr])) << '\n';
    }
}

void read()
{
    std::cin >> n;
    for (int i = 1 ; i <= n ; ++i)
    {
        std::cin >> a[i];
    }

    std::cin >> q;
}

void fastIO()
{
    std::ios_base :: sync_with_stdio(0);
    std::cout.tie(nullptr);
    std::cin.tie(nullptr);
}

int main()
{
    fastIO();
    read();
    solve();

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 25 ms 3156 KB Output is correct
4 Correct 26 ms 2104 KB Output is correct
5 Correct 42 ms 4744 KB Output is correct
6 Correct 28 ms 3332 KB Output is correct
7 Correct 66 ms 4668 KB Output is correct
8 Correct 45 ms 4884 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 328 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 340 KB Output is correct
5 Correct 1 ms 340 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 Incorrect 1 ms 340 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 25 ms 3156 KB Output is correct
4 Correct 26 ms 2104 KB Output is correct
5 Correct 42 ms 4744 KB Output is correct
6 Correct 28 ms 3332 KB Output is correct
7 Correct 66 ms 4668 KB Output is correct
8 Correct 45 ms 4884 KB Output is correct
9 Correct 1 ms 328 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 340 KB Output is correct
13 Correct 1 ms 340 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 Incorrect 1 ms 340 KB Output isn't correct
18 Halted 0 ms 0 KB -