#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2e5;
int n, q, arr[N + 5], b[N + 5];
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> arr[i];
b[i] = 1;
while (arr[i] % 2 == 0) b[i] *= 2, arr[i] /= 2;
b[i] += b[i - 1];
}
cin >> q;
while (q--) {
int x;
cin >> x;
int index = lower_bound(b + 1, b + n + 1, x) - (b + 1) + 1;
cout << arr[index] << '\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
16 ms |
4032 KB |
Output is correct |
4 |
Correct |
27 ms |
2280 KB |
Output is correct |
5 |
Correct |
40 ms |
5488 KB |
Output is correct |
6 |
Correct |
24 ms |
4032 KB |
Output is correct |
7 |
Correct |
40 ms |
5392 KB |
Output is correct |
8 |
Correct |
39 ms |
5440 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
328 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
372 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
360 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
16 ms |
4032 KB |
Output is correct |
4 |
Correct |
27 ms |
2280 KB |
Output is correct |
5 |
Correct |
40 ms |
5488 KB |
Output is correct |
6 |
Correct |
24 ms |
4032 KB |
Output is correct |
7 |
Correct |
40 ms |
5392 KB |
Output is correct |
8 |
Correct |
39 ms |
5440 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 |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
328 KB |
Output is correct |
18 |
Correct |
1 ms |
332 KB |
Output is correct |
19 |
Correct |
1 ms |
372 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
360 KB |
Output is correct |
22 |
Correct |
1 ms |
344 KB |
Output is correct |
23 |
Correct |
24 ms |
3056 KB |
Output is correct |
24 |
Correct |
33 ms |
4872 KB |
Output is correct |
25 |
Correct |
65 ms |
8184 KB |
Output is correct |
26 |
Correct |
42 ms |
5096 KB |
Output is correct |
27 |
Correct |
41 ms |
5068 KB |
Output is correct |
28 |
Correct |
63 ms |
7856 KB |
Output is correct |
29 |
Correct |
60 ms |
7072 KB |
Output is correct |
30 |
Correct |
32 ms |
3128 KB |
Output is correct |
31 |
Correct |
65 ms |
7544 KB |
Output is correct |