#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 200200;
int a[N], p[N];
ll qs[N];
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--) {
ll x;
cin >> x;
cout << a[lower_bound(qs + 1, qs + 1 + n, x) - qs] << '\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
2384 KB |
Output is correct |
3 |
Correct |
14 ms |
3800 KB |
Output is correct |
4 |
Correct |
37 ms |
3992 KB |
Output is correct |
5 |
Correct |
58 ms |
5572 KB |
Output is correct |
6 |
Correct |
35 ms |
4436 KB |
Output is correct |
7 |
Correct |
34 ms |
5472 KB |
Output is correct |
8 |
Correct |
35 ms |
5716 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
2384 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
2 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2400 KB |
Output is correct |
9 |
Correct |
2 ms |
2396 KB |
Output is correct |
10 |
Correct |
2 ms |
2400 KB |
Output is correct |
11 |
Correct |
2 ms |
2400 KB |
Output is correct |
12 |
Correct |
2 ms |
2400 KB |
Output is correct |
13 |
Correct |
1 ms |
2400 KB |
Output is correct |
14 |
Correct |
1 ms |
2400 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
2384 KB |
Output is correct |
3 |
Correct |
14 ms |
3800 KB |
Output is correct |
4 |
Correct |
37 ms |
3992 KB |
Output is correct |
5 |
Correct |
58 ms |
5572 KB |
Output is correct |
6 |
Correct |
35 ms |
4436 KB |
Output is correct |
7 |
Correct |
34 ms |
5472 KB |
Output is correct |
8 |
Correct |
35 ms |
5716 KB |
Output is correct |
9 |
Correct |
1 ms |
2384 KB |
Output is correct |
10 |
Correct |
1 ms |
2384 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
1 ms |
2396 KB |
Output is correct |
14 |
Correct |
1 ms |
2396 KB |
Output is correct |
15 |
Correct |
2 ms |
2396 KB |
Output is correct |
16 |
Correct |
1 ms |
2400 KB |
Output is correct |
17 |
Correct |
2 ms |
2396 KB |
Output is correct |
18 |
Correct |
2 ms |
2400 KB |
Output is correct |
19 |
Correct |
2 ms |
2400 KB |
Output is correct |
20 |
Correct |
2 ms |
2400 KB |
Output is correct |
21 |
Correct |
1 ms |
2400 KB |
Output is correct |
22 |
Correct |
1 ms |
2400 KB |
Output is correct |
23 |
Correct |
19 ms |
5096 KB |
Output is correct |
24 |
Correct |
24 ms |
5984 KB |
Output is correct |
25 |
Correct |
54 ms |
8792 KB |
Output is correct |
26 |
Correct |
39 ms |
6488 KB |
Output is correct |
27 |
Correct |
32 ms |
6232 KB |
Output is correct |
28 |
Correct |
54 ms |
9304 KB |
Output is correct |
29 |
Correct |
84 ms |
8780 KB |
Output is correct |
30 |
Correct |
43 ms |
5716 KB |
Output is correct |
31 |
Correct |
71 ms |
9084 KB |
Output is correct |