#include <bits/stdc++.h>
using namespace std;
int n, q;
long long x, cidx = 1;
vector<pair<long long, long long>> vec;
int main() {
cin.tie(0) -> sync_with_stdio(0);
cin >> n;
while(n--) {
cin >> x;
vec.emplace_back(cidx, (x >> __builtin_ctz(x)));
cidx += (x&-x);
}
cin >> q;
while(q--) {
cin >> x;
auto it = --upper_bound(vec.begin(), vec.end(), pair<long long, long long>(x, LLONG_MAX));
cout << it->second << '\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
16 ms |
4556 KB |
Output is correct |
4 |
Correct |
22 ms |
1492 KB |
Output is correct |
5 |
Correct |
38 ms |
4556 KB |
Output is correct |
6 |
Correct |
24 ms |
4504 KB |
Output is correct |
7 |
Correct |
38 ms |
4536 KB |
Output is correct |
8 |
Correct |
40 ms |
4556 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
0 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 |
212 KB |
Output is correct |
3 |
Correct |
16 ms |
4556 KB |
Output is correct |
4 |
Correct |
22 ms |
1492 KB |
Output is correct |
5 |
Correct |
38 ms |
4556 KB |
Output is correct |
6 |
Correct |
24 ms |
4504 KB |
Output is correct |
7 |
Correct |
38 ms |
4536 KB |
Output is correct |
8 |
Correct |
40 ms |
4556 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
340 KB |
Output is correct |
15 |
Correct |
0 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
0 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
340 KB |
Output is correct |
23 |
Correct |
26 ms |
2024 KB |
Output is correct |
24 |
Correct |
26 ms |
4456 KB |
Output is correct |
25 |
Correct |
52 ms |
5560 KB |
Output is correct |
26 |
Correct |
31 ms |
3020 KB |
Output is correct |
27 |
Correct |
30 ms |
4508 KB |
Output is correct |
28 |
Correct |
54 ms |
4624 KB |
Output is correct |
29 |
Correct |
60 ms |
4556 KB |
Output is correct |
30 |
Correct |
29 ms |
1516 KB |
Output is correct |
31 |
Correct |
54 ms |
4456 KB |
Output is correct |