#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
vector<long long> pref(n + 1);
vector<int> l(n);
for (int i = 0; i < n; i++) {
int x;
cin >> x;
l[i] = x / (x & -x);
pref[i + 1] = pref[i] + (x & -x);
}
int q;
cin >> q;
while (q--) {
long long x;
cin >> x;
cout << l[lower_bound(pref.begin(), pref.end(), x) - pref.begin() - 1] << "\n";
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
22 ms |
3228 KB |
Output is correct |
4 |
Correct |
37 ms |
2172 KB |
Output is correct |
5 |
Correct |
52 ms |
4664 KB |
Output is correct |
6 |
Correct |
31 ms |
3312 KB |
Output is correct |
7 |
Correct |
63 ms |
4672 KB |
Output is correct |
8 |
Correct |
57 ms |
4936 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
320 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
320 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
316 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
328 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
22 ms |
3228 KB |
Output is correct |
4 |
Correct |
37 ms |
2172 KB |
Output is correct |
5 |
Correct |
52 ms |
4664 KB |
Output is correct |
6 |
Correct |
31 ms |
3312 KB |
Output is correct |
7 |
Correct |
63 ms |
4672 KB |
Output is correct |
8 |
Correct |
57 ms |
4936 KB |
Output is correct |
9 |
Correct |
1 ms |
320 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
320 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
316 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
328 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
340 KB |
Output is correct |
23 |
Correct |
31 ms |
2892 KB |
Output is correct |
24 |
Correct |
40 ms |
4640 KB |
Output is correct |
25 |
Correct |
68 ms |
8024 KB |
Output is correct |
26 |
Correct |
41 ms |
5020 KB |
Output is correct |
27 |
Correct |
44 ms |
5020 KB |
Output is correct |
28 |
Correct |
80 ms |
8428 KB |
Output is correct |
29 |
Correct |
73 ms |
7900 KB |
Output is correct |
30 |
Correct |
40 ms |
3636 KB |
Output is correct |
31 |
Correct |
74 ms |
8284 KB |
Output is correct |