#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define MAXN (1000005)
int main() {
ios_base::sync_with_stdio(false);cin.tie(0);
ll N;
cin>>N;
ll arr[N];
for(ll i = 0;i < N;i++){
cin>>arr[i];
}
ll A[N];
ll end[N];
for(ll i = 0;i < N;i++){
ll cnt = 0;
ll a = arr[i];
while(a % 2 == 0){
a /= 2;
cnt++;
}
A[i] = (1ll<<cnt);
end[i] = a;
}
ll ptr = 0;
ll Q;
cin>>Q;
ll total = A[0];
for(ll q = 0;q < Q;q++){
ll X;
cin>>X;
while(total < X){
ptr++;
total += A[ptr];
}
cout<<end[ptr]<<'\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
432 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
22 ms |
5452 KB |
Output is correct |
4 |
Correct |
27 ms |
2688 KB |
Output is correct |
5 |
Correct |
46 ms |
7088 KB |
Output is correct |
6 |
Correct |
26 ms |
5316 KB |
Output is correct |
7 |
Correct |
45 ms |
7096 KB |
Output is correct |
8 |
Correct |
44 ms |
7160 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
324 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
324 KB |
Output is correct |
5 |
Correct |
0 ms |
316 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
324 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
2 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 |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
432 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
22 ms |
5452 KB |
Output is correct |
4 |
Correct |
27 ms |
2688 KB |
Output is correct |
5 |
Correct |
46 ms |
7088 KB |
Output is correct |
6 |
Correct |
26 ms |
5316 KB |
Output is correct |
7 |
Correct |
45 ms |
7096 KB |
Output is correct |
8 |
Correct |
44 ms |
7160 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
324 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
324 KB |
Output is correct |
13 |
Correct |
0 ms |
316 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
332 KB |
Output is correct |
17 |
Correct |
1 ms |
324 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
2 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 |
332 KB |
Output is correct |
23 |
Correct |
24 ms |
3272 KB |
Output is correct |
24 |
Correct |
31 ms |
6348 KB |
Output is correct |
25 |
Correct |
72 ms |
10292 KB |
Output is correct |
26 |
Correct |
42 ms |
6472 KB |
Output is correct |
27 |
Correct |
40 ms |
6604 KB |
Output is correct |
28 |
Correct |
74 ms |
10764 KB |
Output is correct |
29 |
Correct |
77 ms |
10184 KB |
Output is correct |
30 |
Correct |
40 ms |
3948 KB |
Output is correct |
31 |
Correct |
74 ms |
10596 KB |
Output is correct |