#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
int n,q;
ll a[N],cnt[N];
int main(){
cin.tie(nullptr)->sync_with_stdio(false);
cin >> n;
for(int i=1;i<=n;i++){
cin >> a[i];
cnt[i]=a[i]&-a[i];
a[i]/=cnt[i];
cnt[i]+=cnt[i-1];
}
cin >> q;
while(q--){
ll x;
cin >> x;
int idx=lower_bound(cnt+1,cnt+n+1,x)-cnt;
cout << a[idx] << "\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 |
15 ms |
4032 KB |
Output is correct |
4 |
Correct |
24 ms |
2356 KB |
Output is correct |
5 |
Correct |
40 ms |
5440 KB |
Output is correct |
6 |
Correct |
23 ms |
4076 KB |
Output is correct |
7 |
Correct |
39 ms |
5464 KB |
Output is correct |
8 |
Correct |
44 ms |
5620 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
264 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
348 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 |
364 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 |
364 KB |
Output is correct |
# |
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 |
15 ms |
4032 KB |
Output is correct |
4 |
Correct |
24 ms |
2356 KB |
Output is correct |
5 |
Correct |
40 ms |
5440 KB |
Output is correct |
6 |
Correct |
23 ms |
4076 KB |
Output is correct |
7 |
Correct |
39 ms |
5464 KB |
Output is correct |
8 |
Correct |
44 ms |
5620 KB |
Output is correct |
9 |
Correct |
1 ms |
264 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
348 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 |
364 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 |
364 KB |
Output is correct |
23 |
Correct |
22 ms |
2988 KB |
Output is correct |
24 |
Correct |
26 ms |
5208 KB |
Output is correct |
25 |
Correct |
51 ms |
8692 KB |
Output is correct |
26 |
Correct |
33 ms |
5540 KB |
Output is correct |
27 |
Correct |
30 ms |
5588 KB |
Output is correct |
28 |
Correct |
57 ms |
9204 KB |
Output is correct |
29 |
Correct |
55 ms |
8668 KB |
Output is correct |
30 |
Correct |
31 ms |
3728 KB |
Output is correct |
31 |
Correct |
64 ms |
9208 KB |
Output is correct |