Submission #1101039

# Submission time Handle Problem Language Result Execution time Memory
1101039 2024-10-15T11:29:30 Z thinknoexit Intercastellar (JOI22_ho_t1) C++17
0 / 100
1 ms 476 KB
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int a[100100], p[100100];
ll qs[100100];
int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int n;
    cin >> n;
    for (int i = 1;i <= n;i++) {
        cin >> a[i];
        p[i] = 1;
        while (a[i] % 2 == 0) {
            a[i] /= 2;
            p[i] *= 2;
        }
    }
    for (int i = 1;i <= n;i++) {
        qs[i] = qs[i - 1] + p[i];
    }
    int q;
    cin >> q;
    while (q--) {
        int x;
        cin >> x;
        cout << a[upper_bound(qs + 1, qs + 1 + n, x) - qs - 1] << '\n';
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 476 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 476 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 476 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -