#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > vec;
long long a[200005];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n, q;
cin >> n;
for (long long i=0; i<n; i++)
{
long long x, cnt=0;
cin >> x;
while (!(x&1))
{
cnt++;
x>>=1;
}
vec.push_back({1<<cnt, x});
}
for (long long i=1; i<n; i++)
vec[i].first+=vec[i-1].first;
cin >> q;
for (long long i=0; i<q; i++)
{
long long x;
cin >> x;
cout << (*lower_bound(vec.begin(), vec.end(), make_pair(x, 0LL))).second << '\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
0 ms |
336 KB |
Output is correct |
3 |
Correct |
21 ms |
5068 KB |
Output is correct |
4 |
Correct |
27 ms |
2540 KB |
Output is correct |
5 |
Correct |
42 ms |
5688 KB |
Output is correct |
6 |
Correct |
25 ms |
5068 KB |
Output is correct |
7 |
Correct |
42 ms |
5696 KB |
Output is correct |
8 |
Correct |
52 ms |
5704 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 |
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 |
212 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 |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
0 ms |
336 KB |
Output is correct |
3 |
Correct |
21 ms |
5068 KB |
Output is correct |
4 |
Correct |
27 ms |
2540 KB |
Output is correct |
5 |
Correct |
42 ms |
5688 KB |
Output is correct |
6 |
Correct |
25 ms |
5068 KB |
Output is correct |
7 |
Correct |
42 ms |
5696 KB |
Output is correct |
8 |
Correct |
52 ms |
5704 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 |
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 |
212 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 |
348 KB |
Output is correct |
23 |
Correct |
22 ms |
3168 KB |
Output is correct |
24 |
Correct |
29 ms |
6092 KB |
Output is correct |
25 |
Correct |
54 ms |
8856 KB |
Output is correct |
26 |
Correct |
35 ms |
5708 KB |
Output is correct |
27 |
Correct |
34 ms |
6092 KB |
Output is correct |
28 |
Correct |
62 ms |
9344 KB |
Output is correct |
29 |
Correct |
58 ms |
8816 KB |
Output is correct |
30 |
Correct |
31 ms |
3840 KB |
Output is correct |
31 |
Correct |
63 ms |
9272 KB |
Output is correct |