#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll ori[2][200010],pre[200010];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
ll n;
cin>>n;
for(ll i=1;i<=n;i++){
cin>>ori[0][i];
ori[1][i]=1;
while(ori[0][i]%2==0){
ori[1][i]*=2;
ori[0][i]/=2;
}
pre[i]=pre[i-1]+ori[1][i];
}
ll q;
cin>>q;
for(ll i=0;i<q;i++){
ll p;
cin>>p;
ll a=lower_bound(&pre[0],&pre[n+1],p)-&pre[0];
cout<<ori[0][a]<<"\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
328 KB |
Output is correct |
3 |
Correct |
19 ms |
5496 KB |
Output is correct |
4 |
Correct |
29 ms |
2724 KB |
Output is correct |
5 |
Correct |
52 ms |
7080 KB |
Output is correct |
6 |
Correct |
28 ms |
5352 KB |
Output is correct |
7 |
Correct |
49 ms |
7016 KB |
Output is correct |
8 |
Correct |
47 ms |
7176 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
320 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 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 |
324 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 |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
328 KB |
Output is correct |
3 |
Correct |
19 ms |
5496 KB |
Output is correct |
4 |
Correct |
29 ms |
2724 KB |
Output is correct |
5 |
Correct |
52 ms |
7080 KB |
Output is correct |
6 |
Correct |
28 ms |
5352 KB |
Output is correct |
7 |
Correct |
49 ms |
7016 KB |
Output is correct |
8 |
Correct |
47 ms |
7176 KB |
Output is correct |
9 |
Correct |
1 ms |
320 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
0 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 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 |
324 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 |
26 ms |
3280 KB |
Output is correct |
24 |
Correct |
34 ms |
6344 KB |
Output is correct |
25 |
Correct |
65 ms |
10316 KB |
Output is correct |
26 |
Correct |
46 ms |
6476 KB |
Output is correct |
27 |
Correct |
42 ms |
6604 KB |
Output is correct |
28 |
Correct |
95 ms |
10756 KB |
Output is correct |
29 |
Correct |
72 ms |
10260 KB |
Output is correct |
30 |
Correct |
39 ms |
3948 KB |
Output is correct |
31 |
Correct |
75 ms |
10656 KB |
Output is correct |