#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll; typedef pair<int, int> pii;
#define pb emplace_back
#define AI(x) begin(x),end(x)
#define ff first
#define ss second
#ifdef OWO
#define debug(args...) LKJ("\033[0;32m[ " + string(#args) + " ]\033[0m", args)
template<class I> void LKJ(I&&x) { cerr << x << endl; }
template<class I, class...T> void LKJ(I&&x, T&&...t) { cerr << x << ", "; LKJ(t...); }
template<class I> void OI(I a, I b) { while (a < b) cerr << *a << " \n"[next(a) == b]; }
#else
#define debug(...) 0
#define OI(...) 0
#endif
signed main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int N; cin >> N;
vector<int> A(N + 1);
for (int i = 1; i <= N; ++i)
cin >> A[i];
vector<ll> B(N + 1);
for (int i = 1; i <= N; ++i) {
int low = (A[i] & -A[i]);
A[i] /= low;
B[i] = B[i - 1] + low;
}
int Q; cin >> Q;
for (int i = 0; i < Q; ++i) {
ll X; cin >> X;
int p = lower_bound(AI(B), X) - begin(B);
cout << A[p] << '\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
19 ms |
2616 KB |
Output is correct |
4 |
Correct |
28 ms |
1092 KB |
Output is correct |
5 |
Correct |
45 ms |
2944 KB |
Output is correct |
6 |
Correct |
26 ms |
2380 KB |
Output is correct |
7 |
Correct |
46 ms |
3012 KB |
Output is correct |
8 |
Correct |
45 ms |
2976 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
332 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
332 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 |
19 ms |
2616 KB |
Output is correct |
4 |
Correct |
28 ms |
1092 KB |
Output is correct |
5 |
Correct |
45 ms |
2944 KB |
Output is correct |
6 |
Correct |
26 ms |
2380 KB |
Output is correct |
7 |
Correct |
46 ms |
3012 KB |
Output is correct |
8 |
Correct |
45 ms |
2976 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
332 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
332 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
332 KB |
Output is correct |
23 |
Correct |
26 ms |
1852 KB |
Output is correct |
24 |
Correct |
32 ms |
2756 KB |
Output is correct |
25 |
Correct |
64 ms |
4496 KB |
Output is correct |
26 |
Correct |
41 ms |
2400 KB |
Output is correct |
27 |
Correct |
36 ms |
2512 KB |
Output is correct |
28 |
Correct |
69 ms |
3780 KB |
Output is correct |
29 |
Correct |
66 ms |
3008 KB |
Output is correct |
30 |
Correct |
38 ms |
1220 KB |
Output is correct |
31 |
Correct |
70 ms |
3664 KB |
Output is correct |