#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 2e5 + 13;
int l[N], x[N];
int32_t main(){
int n;
cin >> n;
for(int i = 0; i < n; i++){
int v; cin >> v;
int d = 0;
while(v % 2 == 0) d++, v /= 2;
l[i + 1] = 1LL << d;
x[i + 1] = v;
}
for(int i = 0; i < n; i++){
l[i + 1] += l[i];
}
int q;
cin >> q;
for(int i = 0; i < q; i++){
int y;
cin >> y;
int idx = lower_bound(l, l + n + 1, y) - l;
cout << x[idx] << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
316 KB |
Output is correct |
3 |
Correct |
84 ms |
3972 KB |
Output is correct |
4 |
Correct |
270 ms |
2344 KB |
Output is correct |
5 |
Correct |
331 ms |
5432 KB |
Output is correct |
6 |
Correct |
165 ms |
4032 KB |
Output is correct |
7 |
Correct |
374 ms |
5452 KB |
Output is correct |
8 |
Correct |
337 ms |
5736 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 |
340 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 |
1 ms |
320 KB |
Output is correct |
8 |
Correct |
2 ms |
324 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
2 ms |
352 KB |
Output is correct |
12 |
Correct |
3 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
316 KB |
Output is correct |
14 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
316 KB |
Output is correct |
3 |
Correct |
84 ms |
3972 KB |
Output is correct |
4 |
Correct |
270 ms |
2344 KB |
Output is correct |
5 |
Correct |
331 ms |
5432 KB |
Output is correct |
6 |
Correct |
165 ms |
4032 KB |
Output is correct |
7 |
Correct |
374 ms |
5452 KB |
Output is correct |
8 |
Correct |
337 ms |
5736 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 |
340 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 |
1 ms |
320 KB |
Output is correct |
16 |
Correct |
2 ms |
324 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
2 ms |
352 KB |
Output is correct |
20 |
Correct |
3 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
316 KB |
Output is correct |
22 |
Correct |
2 ms |
340 KB |
Output is correct |
23 |
Correct |
213 ms |
2952 KB |
Output is correct |
24 |
Correct |
178 ms |
5196 KB |
Output is correct |
25 |
Correct |
396 ms |
8812 KB |
Output is correct |
26 |
Correct |
250 ms |
5592 KB |
Output is correct |
27 |
Correct |
206 ms |
5444 KB |
Output is correct |
28 |
Correct |
446 ms |
9132 KB |
Output is correct |
29 |
Correct |
443 ms |
8656 KB |
Output is correct |
30 |
Correct |
289 ms |
3736 KB |
Output is correct |
31 |
Correct |
471 ms |
9196 KB |
Output is correct |