#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 |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
98 ms |
5536 KB |
Output is correct |
4 |
Correct |
264 ms |
1852 KB |
Output is correct |
5 |
Correct |
353 ms |
5672 KB |
Output is correct |
6 |
Correct |
229 ms |
5564 KB |
Output is correct |
7 |
Correct |
350 ms |
5492 KB |
Output is correct |
8 |
Correct |
383 ms |
5612 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 |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 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 |
340 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 |
98 ms |
5536 KB |
Output is correct |
4 |
Correct |
264 ms |
1852 KB |
Output is correct |
5 |
Correct |
353 ms |
5672 KB |
Output is correct |
6 |
Correct |
229 ms |
5564 KB |
Output is correct |
7 |
Correct |
350 ms |
5492 KB |
Output is correct |
8 |
Correct |
383 ms |
5612 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
1 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 |
340 KB |
Output is correct |
23 |
Correct |
213 ms |
2320 KB |
Output is correct |
24 |
Correct |
190 ms |
5456 KB |
Output is correct |
25 |
Correct |
419 ms |
6976 KB |
Output is correct |
26 |
Correct |
257 ms |
3980 KB |
Output is correct |
27 |
Correct |
244 ms |
5480 KB |
Output is correct |
28 |
Correct |
482 ms |
6344 KB |
Output is correct |
29 |
Correct |
456 ms |
5464 KB |
Output is correct |
30 |
Correct |
308 ms |
1756 KB |
Output is correct |
31 |
Correct |
443 ms |
6060 KB |
Output is correct |