답안 #899448

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
899448 2024-01-06T08:01:38 Z Ice_man Intercastellar (JOI22_ho_t1) C++14
25 / 100
38 ms 5780 KB
#include <iostream>
#include <chrono>
#include <algorithm>

#define maxn 200005
#define maxlog 20
#define INF 1000000010
#define LINF 1000000000000000005
#define endl '\n'
#define pb(x) push_back(x)
#define X first
#define Y second
#define control cout<<"passed"<<endl;

#pragma GCC optimize("O3" , "Ofast" , "unroll-loops" , "fast-math")
#pragma GCC target("avx2")

using namespace std;

std::chrono::high_resolution_clock::time_point startT, currT;
constexpr double TIME_MULT = 1;

double timePassed()
{
    using namespace std::chrono;
    currT = high_resolution_clock::now();
    double time = duration_cast<duration<double>>(currT - startT).count();
    return time * TIME_MULT;
}

long long n , q;

long long a[maxn] , br[maxn];

void read()
{
    cin >> n;

    for(int i = 1; i <= n; i++)
        cin >> a[i];

}

void solve()
{
    for(int i = 1; i <= n; i++)
    {
        br[i] = 1;

        while(a[i] % 2 == 0)
        {
            a[i] /= 2;
            br[i] *= 2;
        }

        br[i] += br[i - 1];

    }

}

void answer()
{
    cin >> q;

    int pos;
    while(q--)
    {
        cin >> pos;

        cout << a[lower_bound(br + 1 , br + 1 + n , pos) - br] << endl;

    }

}


int main()
{

/**#ifdef ONLINE_JUDGE
    freopen("taxi.in", "r", stdin);
    freopen("taxi.out", "w", stdout);
#endif*/

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    startT = std::chrono::high_resolution_clock::now();

    read();
    solve();
    answer();


    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 15 ms 4188 KB Output is correct
4 Correct 23 ms 3960 KB Output is correct
5 Correct 37 ms 5576 KB Output is correct
6 Correct 22 ms 4444 KB Output is correct
7 Correct 38 ms 5580 KB Output is correct
8 Correct 37 ms 5780 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2388 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2648 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2392 KB Output is correct
9 Incorrect 1 ms 2396 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 15 ms 4188 KB Output is correct
4 Correct 23 ms 3960 KB Output is correct
5 Correct 37 ms 5576 KB Output is correct
6 Correct 22 ms 4444 KB Output is correct
7 Correct 38 ms 5580 KB Output is correct
8 Correct 37 ms 5780 KB Output is correct
9 Correct 1 ms 2388 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 0 ms 2648 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2392 KB Output is correct
17 Incorrect 1 ms 2396 KB Output isn't correct
18 Halted 0 ms 0 KB -