#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 3;
int n, q, a[N];
long long prf[N];
void solve() {
cin >> n;
for (int i = 1; i <= n; ++i) {
cin >> a[i];
prf[i] = prf[i - 1] + (a[i] & -a[i]);
}
cin >> q;
while (q--) {
long long x; cin >> x;
int p = lower_bound(prf + 1, prf + n + 1, x) - prf;
cout << a[p] / (a[p] & -a[p]) << '\n';
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
252 KB |
Output is correct |
3 |
Correct |
21 ms |
3124 KB |
Output is correct |
4 |
Correct |
31 ms |
1880 KB |
Output is correct |
5 |
Correct |
49 ms |
4164 KB |
Output is correct |
6 |
Correct |
27 ms |
3268 KB |
Output is correct |
7 |
Correct |
50 ms |
4196 KB |
Output is correct |
8 |
Correct |
60 ms |
4844 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
316 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
320 KB |
Output is correct |
5 |
Correct |
1 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 |
324 KB |
Output is correct |
9 |
Correct |
0 ms |
332 KB |
Output is correct |
10 |
Correct |
1 ms |
328 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 |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
252 KB |
Output is correct |
3 |
Correct |
21 ms |
3124 KB |
Output is correct |
4 |
Correct |
31 ms |
1880 KB |
Output is correct |
5 |
Correct |
49 ms |
4164 KB |
Output is correct |
6 |
Correct |
27 ms |
3268 KB |
Output is correct |
7 |
Correct |
50 ms |
4196 KB |
Output is correct |
8 |
Correct |
60 ms |
4844 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
316 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
320 KB |
Output is correct |
13 |
Correct |
1 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 |
324 KB |
Output is correct |
17 |
Correct |
0 ms |
332 KB |
Output is correct |
18 |
Correct |
1 ms |
328 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 |
332 KB |
Output is correct |
23 |
Correct |
34 ms |
2896 KB |
Output is correct |
24 |
Correct |
35 ms |
4184 KB |
Output is correct |
25 |
Correct |
68 ms |
7260 KB |
Output is correct |
26 |
Correct |
43 ms |
4688 KB |
Output is correct |
27 |
Correct |
37 ms |
4424 KB |
Output is correct |
28 |
Correct |
79 ms |
8176 KB |
Output is correct |
29 |
Correct |
70 ms |
7200 KB |
Output is correct |
30 |
Correct |
39 ms |
3472 KB |
Output is correct |
31 |
Correct |
78 ms |
7992 KB |
Output is correct |