#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> a(n);
vector<long long> p(n + 1);
for (int i = 0; i < n; i++) {
cin >> a[i];
int tz = __builtin_ctz(a[i]);
p[i + 1] = p[i] + (1 << tz);
a[i] >>= tz;
}
int q;
cin >> q;
while (q--) {
int x;
cin >> x;
cout << a[lower_bound(p.begin(), p.end(), x) - p.begin() - 1] << '\n';
}
}
# |
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 |
21 ms |
3348 KB |
Output is correct |
4 |
Correct |
30 ms |
2080 KB |
Output is correct |
5 |
Correct |
47 ms |
4756 KB |
Output is correct |
6 |
Correct |
26 ms |
3412 KB |
Output is correct |
7 |
Correct |
48 ms |
4684 KB |
Output is correct |
8 |
Correct |
50 ms |
4832 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 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 |
332 KB |
Output is correct |
9 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
21 ms |
3348 KB |
Output is correct |
4 |
Correct |
30 ms |
2080 KB |
Output is correct |
5 |
Correct |
47 ms |
4756 KB |
Output is correct |
6 |
Correct |
26 ms |
3412 KB |
Output is correct |
7 |
Correct |
48 ms |
4684 KB |
Output is correct |
8 |
Correct |
50 ms |
4832 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 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 |
332 KB |
Output is correct |
17 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |