#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define IO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pii pair<int,int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf push_front
#define all(x) x.begin(),x.end()
#define de(x) cout << #x << ':' << x << '\n';
template<class T> void prt(T l,T r){
while(l!=r) cout << *l << '\n',l++;
cout << '\n';
}
const int N=1e6+5,M=1e9+7,INF=1e18;
signed main(){
IO
int n;cin >> n;
vector<int> a(n),b(n,1);
for(int i=0;i<n;i++){
cin >> a[i];
while(a[i]%2==0){
a[i]/=2;
b[i]*=2;
}
}
int q;cin >> q;
int li=0,x;
while(q--){
cin >> x;
while(b[li]<x){
b[li+1]+=b[li];
li++;
}
cout << a[li] << '\n';
}
return 0;
}
# |
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 |
19 ms |
3968 KB |
Output is correct |
4 |
Correct |
24 ms |
2356 KB |
Output is correct |
5 |
Correct |
43 ms |
5488 KB |
Output is correct |
6 |
Correct |
29 ms |
4052 KB |
Output is correct |
7 |
Correct |
45 ms |
5568 KB |
Output is correct |
8 |
Correct |
44 ms |
5580 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 |
316 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 |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
332 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 |
328 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 |
19 ms |
3968 KB |
Output is correct |
4 |
Correct |
24 ms |
2356 KB |
Output is correct |
5 |
Correct |
43 ms |
5488 KB |
Output is correct |
6 |
Correct |
29 ms |
4052 KB |
Output is correct |
7 |
Correct |
45 ms |
5568 KB |
Output is correct |
8 |
Correct |
44 ms |
5580 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 |
316 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 |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
332 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
332 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 |
328 KB |
Output is correct |
23 |
Correct |
26 ms |
3020 KB |
Output is correct |
24 |
Correct |
31 ms |
5208 KB |
Output is correct |
25 |
Correct |
68 ms |
8812 KB |
Output is correct |
26 |
Correct |
60 ms |
5488 KB |
Output is correct |
27 |
Correct |
50 ms |
5580 KB |
Output is correct |
28 |
Correct |
90 ms |
9196 KB |
Output is correct |
29 |
Correct |
104 ms |
8652 KB |
Output is correct |
30 |
Correct |
38 ms |
3648 KB |
Output is correct |
31 |
Correct |
95 ms |
9088 KB |
Output is correct |