제출 #528772

#제출 시각아이디문제언어결과실행 시간메모리
528772FireGhost1301Intercastellar (JOI22_ho_t1)C++11
100 / 100
79 ms8176 KiB
#include <bits/stdc++.h>
using namespace std;

const int N = 2e5 + 3;
int n, q, a[N];
long long prf[N];

void solve() {
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        prf[i] = prf[i - 1] + (a[i] & -a[i]);
    }
    cin >> q;
    while (q--) {
        long long x; cin >> x;
        int p = lower_bound(prf + 1, prf + n + 1, x) - prf;
        cout << a[p] / (a[p] & -a[p]) << '\n';
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...