#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
using namespace std;
int n,q;
ll a[200001];
vector<pair<ll,ll> > v;
int main(){
cin>>n;
for(int k=1;k<=n;k++){
cin>>a[k];
ll x=0,y=1;
while(a[k]%2==0){
y*=2;
a[k]/=2;
}
x=a[k];
v.push_back({y,x});
}
cin>>q;
ll sum=0;
int ind=-1;
while(q--){
ll f;
cin>>f;
while(sum<f){
ind++;
sum+=v[ind].ff;
}
cout<<v[ind].ss<<"\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
93 ms |
5528 KB |
Output is correct |
4 |
Correct |
249 ms |
1772 KB |
Output is correct |
5 |
Correct |
384 ms |
5552 KB |
Output is correct |
6 |
Correct |
185 ms |
5476 KB |
Output is correct |
7 |
Correct |
370 ms |
5572 KB |
Output is correct |
8 |
Correct |
365 ms |
5572 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 |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
3 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
3 ms |
340 KB |
Output is correct |
12 |
Correct |
3 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
3 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
93 ms |
5528 KB |
Output is correct |
4 |
Correct |
249 ms |
1772 KB |
Output is correct |
5 |
Correct |
384 ms |
5552 KB |
Output is correct |
6 |
Correct |
185 ms |
5476 KB |
Output is correct |
7 |
Correct |
370 ms |
5572 KB |
Output is correct |
8 |
Correct |
365 ms |
5572 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 |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
3 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
3 ms |
340 KB |
Output is correct |
20 |
Correct |
3 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
3 ms |
348 KB |
Output is correct |
23 |
Correct |
208 ms |
2256 KB |
Output is correct |
24 |
Correct |
190 ms |
5532 KB |
Output is correct |
25 |
Correct |
436 ms |
6960 KB |
Output is correct |
26 |
Correct |
261 ms |
3932 KB |
Output is correct |
27 |
Correct |
224 ms |
5496 KB |
Output is correct |
28 |
Correct |
480 ms |
6260 KB |
Output is correct |
29 |
Correct |
489 ms |
5476 KB |
Output is correct |
30 |
Correct |
293 ms |
1728 KB |
Output is correct |
31 |
Correct |
451 ms |
5992 KB |
Output is correct |