#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
int64_t pk[n],a[n];
for(int i = 0;i < n;++i)
{
cin >> a[i];
pk[i] = 1;
while(a[i]%2 == 0)
{
a[i]/=2;
pk[i] *= 2;
}
pk[i] += (i == 0 ? 0 : pk[i-1]);
}
int q;
cin >> q;
while(q--)
{
int64_t x;
cin >> x;
cout << a[lower_bound(pk,pk+n,x)-pk] << "\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
452 KB |
Output is correct |
3 |
Correct |
17 ms |
3932 KB |
Output is correct |
4 |
Correct |
24 ms |
2392 KB |
Output is correct |
5 |
Correct |
40 ms |
5464 KB |
Output is correct |
6 |
Correct |
30 ms |
4184 KB |
Output is correct |
7 |
Correct |
50 ms |
5456 KB |
Output is correct |
8 |
Correct |
40 ms |
5684 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
500 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
464 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
452 KB |
Output is correct |
3 |
Correct |
17 ms |
3932 KB |
Output is correct |
4 |
Correct |
24 ms |
2392 KB |
Output is correct |
5 |
Correct |
40 ms |
5464 KB |
Output is correct |
6 |
Correct |
30 ms |
4184 KB |
Output is correct |
7 |
Correct |
50 ms |
5456 KB |
Output is correct |
8 |
Correct |
40 ms |
5684 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
500 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
464 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
22 ms |
3164 KB |
Output is correct |
24 |
Correct |
27 ms |
5204 KB |
Output is correct |
25 |
Correct |
53 ms |
8920 KB |
Output is correct |
26 |
Correct |
35 ms |
5708 KB |
Output is correct |
27 |
Correct |
42 ms |
5748 KB |
Output is correct |
28 |
Correct |
60 ms |
9300 KB |
Output is correct |
29 |
Correct |
60 ms |
8788 KB |
Output is correct |
30 |
Correct |
30 ms |
3672 KB |
Output is correct |
31 |
Correct |
61 ms |
9040 KB |
Output is correct |