답안 #527484

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
527484 2022-02-17T13:18:22 Z voventa Intercastellar (JOI22_ho_t1) C++17
100 / 100
76 ms 10512 KB
#include <bits/stdc++.h>
#define x first
#define y second
#define sz(a) (int)a.size()
#define pb push_back
#define int long long

using namespace std;
typedef long long ll;

const int K = 5000;

void solve();

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    //cin >> t;
    while (t--)
        solve();
    return 0;
}

pair <int, int> a[200010];
int pref[200010];

int get(int x) {
    int t = 1;
    while (x % 2 == 0) {
        t *= 2;
        x /= 2;
    }
    return t;
}

void solve() {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i].x;
        a[i].y = get(a[i].x);
    }
    for (int i = 1; i <= n; ++i)
        pref[i] = pref[i - 1] + a[i - 1].y;
    int q, x;
    cin >> q;
    for (int i = 0; i < q; ++i) {
        cin >> x;
        int t = lower_bound(pref, pref + n + 1, x) - pref - 1;
        cout << a[t].x / a[t].y << '\n';
    }

}
//923953850098595069
//890909762780980010

# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 20 ms 5304 KB Output is correct
4 Correct 30 ms 2440 KB Output is correct
5 Correct 58 ms 6496 KB Output is correct
6 Correct 28 ms 5320 KB Output is correct
7 Correct 50 ms 6536 KB Output is correct
8 Correct 49 ms 7028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 244 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 316 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 328 KB Output is correct
12 Correct 1 ms 328 KB Output is correct
13 Correct 1 ms 324 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 20 ms 5304 KB Output is correct
4 Correct 30 ms 2440 KB Output is correct
5 Correct 58 ms 6496 KB Output is correct
6 Correct 28 ms 5320 KB Output is correct
7 Correct 50 ms 6536 KB Output is correct
8 Correct 49 ms 7028 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 244 KB Output is correct
12 Correct 0 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 316 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 328 KB Output is correct
20 Correct 1 ms 328 KB Output is correct
21 Correct 1 ms 324 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 28 ms 3008 KB Output is correct
24 Correct 34 ms 5824 KB Output is correct
25 Correct 64 ms 9552 KB Output is correct
26 Correct 47 ms 6188 KB Output is correct
27 Correct 44 ms 6104 KB Output is correct
28 Correct 76 ms 10512 KB Output is correct
29 Correct 75 ms 9524 KB Output is correct
30 Correct 41 ms 3844 KB Output is correct
31 Correct 76 ms 10328 KB Output is correct