This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
const int N = 2e5 + 5;
ll a[N], pref[N];
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
int n, q;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
ll mult = 1;
while (a[i] % 2 == 0) a[i] /= 2, mult *= 2;
pref[i] = pref[i - 1] + mult;
}
cin >> q;
ll id = 0;
while (q--) {
ll x;
cin >> x;
while (pref[id] < x) id++;
cout << a[id] << "\n";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |