#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 2e5 + 42, INF = 1e18;
int n, q, nb[N], val[N];
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
for(int i = 0; i < n; i++) {
int a; cin >> a;
nb[i] = a & (-a);
val[i] = a / nb[i];
}
for(int i = 1; i < n; i++)
nb[i] += nb[i-1];
cin >> q;
int id = 0;
for(int i = 0; i < q; i++) {
int x; cin >> x;
while(nb[id] < x)
id++;
cout << val[id] << '\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
19 ms |
3908 KB |
Output is correct |
4 |
Correct |
26 ms |
2380 KB |
Output is correct |
5 |
Correct |
51 ms |
5484 KB |
Output is correct |
6 |
Correct |
23 ms |
4044 KB |
Output is correct |
7 |
Correct |
41 ms |
5548 KB |
Output is correct |
8 |
Correct |
43 ms |
5680 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 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 |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 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 |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
19 ms |
3908 KB |
Output is correct |
4 |
Correct |
26 ms |
2380 KB |
Output is correct |
5 |
Correct |
51 ms |
5484 KB |
Output is correct |
6 |
Correct |
23 ms |
4044 KB |
Output is correct |
7 |
Correct |
41 ms |
5548 KB |
Output is correct |
8 |
Correct |
43 ms |
5680 KB |
Output is correct |
9 |
Correct |
0 ms |
340 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 |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
1 ms |
340 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 |
24 ms |
3084 KB |
Output is correct |
24 |
Correct |
31 ms |
5196 KB |
Output is correct |
25 |
Correct |
59 ms |
8712 KB |
Output is correct |
26 |
Correct |
40 ms |
5592 KB |
Output is correct |
27 |
Correct |
35 ms |
5584 KB |
Output is correct |
28 |
Correct |
65 ms |
9172 KB |
Output is correct |
29 |
Correct |
63 ms |
8628 KB |
Output is correct |
30 |
Correct |
36 ms |
3728 KB |
Output is correct |
31 |
Correct |
86 ms |
9156 KB |
Output is correct |