#include <bits/stdc++.h>
using namespace std;
#define int long long
const int Z = 2e5;
int N, Q, A[Z], B[Z];
int32_t main() {
ios::sync_with_stdio(0), cin.tie(0);
cin >> N;
for(int i = 0; i < N; ++i) {
int u, v; cin >> u;
v = u;
while(!(v & 1))
v /= 2;
A[i] = u / v;
B[i] = v;
if(i) A[i] += A[i-1];
}
cin >> Q;
while(Q--) {
int x; cin >> x;
cout << B[lower_bound(A, A + N, x) - A] << '\n';
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
20 ms |
3852 KB |
Output is correct |
4 |
Correct |
32 ms |
2064 KB |
Output is correct |
5 |
Correct |
51 ms |
4916 KB |
Output is correct |
6 |
Correct |
27 ms |
4036 KB |
Output is correct |
7 |
Correct |
49 ms |
4932 KB |
Output is correct |
8 |
Correct |
49 ms |
5428 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
0 ms |
332 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
332 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
1 ms |
360 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
20 ms |
3852 KB |
Output is correct |
4 |
Correct |
32 ms |
2064 KB |
Output is correct |
5 |
Correct |
51 ms |
4916 KB |
Output is correct |
6 |
Correct |
27 ms |
4036 KB |
Output is correct |
7 |
Correct |
49 ms |
4932 KB |
Output is correct |
8 |
Correct |
49 ms |
5428 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
1 ms |
332 KB |
Output is correct |
16 |
Correct |
1 ms |
332 KB |
Output is correct |
17 |
Correct |
0 ms |
332 KB |
Output is correct |
18 |
Correct |
1 ms |
332 KB |
Output is correct |
19 |
Correct |
1 ms |
332 KB |
Output is correct |
20 |
Correct |
1 ms |
332 KB |
Output is correct |
21 |
Correct |
1 ms |
332 KB |
Output is correct |
22 |
Correct |
1 ms |
360 KB |
Output is correct |
23 |
Correct |
26 ms |
2780 KB |
Output is correct |
24 |
Correct |
35 ms |
4808 KB |
Output is correct |
25 |
Correct |
70 ms |
6820 KB |
Output is correct |
26 |
Correct |
44 ms |
4380 KB |
Output is correct |
27 |
Correct |
42 ms |
4484 KB |
Output is correct |
28 |
Correct |
86 ms |
5932 KB |
Output is correct |
29 |
Correct |
82 ms |
5184 KB |
Output is correct |
30 |
Correct |
41 ms |
2820 KB |
Output is correct |
31 |
Correct |
84 ms |
5720 KB |
Output is correct |