#include <bits/stdc++.h>
using namespace std;
long long a[200001];
long long b[200001];
long long c[200001];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//freopen(".INP","r",stdin);
// freopen(".OUT","w",stdout);
int n;
cin>>n;
for (int i=1;i<=n;i++){
cin>>a[i];
long long dd=a[i];
while (dd%2==0){
dd/=2;
}
b[i]=a[i]/dd;
b[i]+=b[i-1];
c[i]=dd;
}
int q;
cin>>q;
for (int i=1;i<=q;i++){
long long h;
cin>>h;
int l=1,r=n,ans=n;
while (l<=r){
int mid=(l+r)/2;
if (b[mid]>=h){
r=mid-1;
ans=mid;
}
else l=mid+1;
}
cout<<c[ans]<<'\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
22 ms |
5544 KB |
Output is correct |
4 |
Correct |
28 ms |
2704 KB |
Output is correct |
5 |
Correct |
61 ms |
7084 KB |
Output is correct |
6 |
Correct |
28 ms |
5324 KB |
Output is correct |
7 |
Correct |
50 ms |
7116 KB |
Output is correct |
8 |
Correct |
50 ms |
7112 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
324 KB |
Output is correct |
5 |
Correct |
0 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 |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
384 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 |
340 KB |
Output is correct |
3 |
Correct |
22 ms |
5544 KB |
Output is correct |
4 |
Correct |
28 ms |
2704 KB |
Output is correct |
5 |
Correct |
61 ms |
7084 KB |
Output is correct |
6 |
Correct |
28 ms |
5324 KB |
Output is correct |
7 |
Correct |
50 ms |
7116 KB |
Output is correct |
8 |
Correct |
50 ms |
7112 KB |
Output is correct |
9 |
Correct |
0 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 |
324 KB |
Output is correct |
13 |
Correct |
0 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 |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
1 ms |
384 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 |
3228 KB |
Output is correct |
24 |
Correct |
34 ms |
6300 KB |
Output is correct |
25 |
Correct |
72 ms |
10352 KB |
Output is correct |
26 |
Correct |
46 ms |
6568 KB |
Output is correct |
27 |
Correct |
50 ms |
6600 KB |
Output is correct |
28 |
Correct |
79 ms |
10772 KB |
Output is correct |
29 |
Correct |
78 ms |
10228 KB |
Output is correct |
30 |
Correct |
41 ms |
3856 KB |
Output is correct |
31 |
Correct |
75 ms |
10680 KB |
Output is correct |