답안 #941066

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
941066 2024-03-08T06:15:33 Z Pring Intercastellar (JOI22_ho_t1) C++17
100 / 100
75 ms 10880 KB
#include <bits/stdc++.h>
using namespace std;

#ifdef MIKU
const string dbmc = "\033[1;38;2;57;197;187m", dbrs = "\033[0m";
#define debug(x...) cout << dbmc << "[" << #x << "]: ", dout(x)
void dout() { cout << dbrs << endl; }
template <typename T, typename ...U>
void dout(T t, U ...u) { cout << t << (sizeof...(u) ? ", " : ""); dout(u...); }
#else
#define dout(...) 39
#endif

#define int long long
#define fs first
#define sc second
#define mp make_pair
#define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++)
typedef pair<int, int> pii;

const int MXN = 200005;
int n, q, a[MXN], x;
int cnt[MXN], p[MXN];

void miku() {
    cin >> n;
    FOR(i, 0, n) {
        cin >> a[i];
        cnt[i] = 1;
        while (a[i] % 2 == 0) {
            a[i] /= 2;
            cnt[i] *= 2;
        }
    }
    FOR(i, 0, n) p[i + 1] = p[i] + cnt[i];

    // FOR(i, 0, n + 1) cout << p[i] << ' ';
    // cout << endl;
    // FOR(i, 0, n + 1) cout << a[i] << ' ';
    // cout << endl;

    cin >> q;
    while (q--) {
        cin >> x;
        int id = lower_bound(p, p + n, x) - p;
        id--;
        cout << a[id] << '\n';
    }
}

int32_t main() {
    cin.tie(0) -> sync_with_stdio(false);
    cin.exceptions(cin.failbit);
    miku();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 15 ms 5160 KB Output is correct
4 Correct 23 ms 4956 KB Output is correct
5 Correct 55 ms 5416 KB Output is correct
6 Correct 28 ms 4948 KB Output is correct
7 Correct 38 ms 5460 KB Output is correct
8 Correct 38 ms 5456 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4572 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4564 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4572 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4696 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 15 ms 5160 KB Output is correct
4 Correct 23 ms 4956 KB Output is correct
5 Correct 55 ms 5416 KB Output is correct
6 Correct 28 ms 4948 KB Output is correct
7 Correct 38 ms 5460 KB Output is correct
8 Correct 38 ms 5456 KB Output is correct
9 Correct 1 ms 4440 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4572 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4564 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4572 KB Output is correct
21 Correct 1 ms 4444 KB Output is correct
22 Correct 1 ms 4696 KB Output is correct
23 Correct 22 ms 6748 KB Output is correct
24 Correct 26 ms 7256 KB Output is correct
25 Correct 50 ms 10328 KB Output is correct
26 Correct 34 ms 8016 KB Output is correct
27 Correct 46 ms 7548 KB Output is correct
28 Correct 71 ms 10880 KB Output is correct
29 Correct 75 ms 10320 KB Output is correct
30 Correct 30 ms 7888 KB Output is correct
31 Correct 59 ms 10832 KB Output is correct