#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (ll)(r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (ll)(l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;
int main()
{
cin.tie(0) -> sync_with_stdio(false);
int n;
cin >> n;
vector<ll> a(n), b(n+1);
Loop (i,0,n)
cin >> a[i];
Loop (i,0,n)
b[i+1] = b[i] + (a[i] & -a[i]);
int q;
cin >> q;
while (q--) {
ll x;
cin >> x;
int i = lower_bound(b.begin(), b.end(), x) - b.begin() - 1;
cout << a[i] / (a[i] & -a[i]) << '\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
17 ms |
3412 KB |
Output is correct |
4 |
Correct |
27 ms |
1364 KB |
Output is correct |
5 |
Correct |
49 ms |
3840 KB |
Output is correct |
6 |
Correct |
28 ms |
3028 KB |
Output is correct |
7 |
Correct |
46 ms |
3820 KB |
Output is correct |
8 |
Correct |
48 ms |
3776 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
320 KB |
Output is correct |
11 |
Correct |
1 ms |
356 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
360 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
17 ms |
3412 KB |
Output is correct |
4 |
Correct |
27 ms |
1364 KB |
Output is correct |
5 |
Correct |
49 ms |
3840 KB |
Output is correct |
6 |
Correct |
28 ms |
3028 KB |
Output is correct |
7 |
Correct |
46 ms |
3820 KB |
Output is correct |
8 |
Correct |
48 ms |
3776 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
320 KB |
Output is correct |
19 |
Correct |
1 ms |
356 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
360 KB |
Output is correct |
23 |
Correct |
27 ms |
3020 KB |
Output is correct |
24 |
Correct |
34 ms |
5212 KB |
Output is correct |
25 |
Correct |
67 ms |
8812 KB |
Output is correct |
26 |
Correct |
40 ms |
5580 KB |
Output is correct |
27 |
Correct |
38 ms |
5624 KB |
Output is correct |
28 |
Correct |
71 ms |
9200 KB |
Output is correct |
29 |
Correct |
72 ms |
8652 KB |
Output is correct |
30 |
Correct |
49 ms |
3780 KB |
Output is correct |
31 |
Correct |
80 ms |
9112 KB |
Output is correct |