#include <bits/stdc++.h>
#include <bits/extc++.h>
#define uwu return 0;
using namespace std;
#define fs first
#define sc second
using ll = long long;
const int SIZE = 2e5 + 5;
int N, Q;
ll arr[SIZE], x;
ll div(ll i){
ll a = arr[i], ret = 1;
while(!(a & 1)){
a >>= 1;
arr[i] >>= 1;
ret <<= 1;
}
return ret;
}
int main(){
cin.tie(0), ios::sync_with_stdio(0);
cin >> N;
for (int i = 1; i <= N;i++){
cin >> arr[i];
}
cin >> Q;
ll nttl = 0, i = 0;
while(Q--){
cin >> x;
while(nttl < x){
nttl += div(++i);
}
cout << arr[i] << '\n';
}
uwu
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
14 ms |
2652 KB |
Output is correct |
4 |
Correct |
21 ms |
1880 KB |
Output is correct |
5 |
Correct |
34 ms |
3920 KB |
Output is correct |
6 |
Correct |
21 ms |
2900 KB |
Output is correct |
7 |
Correct |
40 ms |
4120 KB |
Output is correct |
8 |
Correct |
34 ms |
4152 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
476 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
496 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
468 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
14 ms |
2652 KB |
Output is correct |
4 |
Correct |
21 ms |
1880 KB |
Output is correct |
5 |
Correct |
34 ms |
3920 KB |
Output is correct |
6 |
Correct |
21 ms |
2900 KB |
Output is correct |
7 |
Correct |
40 ms |
4120 KB |
Output is correct |
8 |
Correct |
34 ms |
4152 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
476 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
496 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
468 KB |
Output is correct |
22 |
Correct |
1 ms |
344 KB |
Output is correct |
23 |
Correct |
22 ms |
2896 KB |
Output is correct |
24 |
Correct |
25 ms |
4116 KB |
Output is correct |
25 |
Correct |
47 ms |
7248 KB |
Output is correct |
26 |
Correct |
32 ms |
4628 KB |
Output is correct |
27 |
Correct |
28 ms |
4464 KB |
Output is correct |
28 |
Correct |
55 ms |
7636 KB |
Output is correct |
29 |
Correct |
51 ms |
7028 KB |
Output is correct |
30 |
Correct |
32 ms |
3680 KB |
Output is correct |
31 |
Correct |
56 ms |
7484 KB |
Output is correct |