#include <bits/stdc++.h>
using namespace std;
inline namespace
{
} // namespace
void solve(int _test_ = -1)
{
int n;
cin >> n;
vector<long> a(n);
for (long &x : a)
cin >> x;
vector<pair<long, long>> b(n);
for (int i = 0; i < n; i++)
{
long tz = __builtin_ctzl(a[i]);
b[i] = pair(a[i] >> tz, 1l << tz);
}
int q;
cin >> q;
int j = 0;
long c = 0;
for (int z = 0; z < q; z++)
{
long d;
cin >> d;
while (c + b[j].second < d)
{
c += b[j].second;
j++;
}
cout << b[j].first << '\n';
}
}
int main()
{
ios_base::sync_with_stdio(false), cin.tie(NULL);
int T_ = 1;
// cin >> T_;
for (int t_ = 0; t_ < T_; t_++)
solve(t_);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
316 KB |
Output is correct |
3 |
Correct |
18 ms |
5460 KB |
Output is correct |
4 |
Correct |
25 ms |
2636 KB |
Output is correct |
5 |
Correct |
46 ms |
7112 KB |
Output is correct |
6 |
Correct |
27 ms |
5328 KB |
Output is correct |
7 |
Correct |
41 ms |
7116 KB |
Output is correct |
8 |
Correct |
44 ms |
7160 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
320 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 |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 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 |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 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 |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
316 KB |
Output is correct |
3 |
Correct |
18 ms |
5460 KB |
Output is correct |
4 |
Correct |
25 ms |
2636 KB |
Output is correct |
5 |
Correct |
46 ms |
7112 KB |
Output is correct |
6 |
Correct |
27 ms |
5328 KB |
Output is correct |
7 |
Correct |
41 ms |
7116 KB |
Output is correct |
8 |
Correct |
44 ms |
7160 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
320 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 |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 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 |
340 KB |
Output is correct |
19 |
Correct |
1 ms |
340 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 |
340 KB |
Output is correct |
23 |
Correct |
28 ms |
3264 KB |
Output is correct |
24 |
Correct |
33 ms |
6340 KB |
Output is correct |
25 |
Correct |
64 ms |
10320 KB |
Output is correct |
26 |
Correct |
43 ms |
6604 KB |
Output is correct |
27 |
Correct |
38 ms |
6664 KB |
Output is correct |
28 |
Correct |
69 ms |
10792 KB |
Output is correct |
29 |
Correct |
70 ms |
10208 KB |
Output is correct |
30 |
Correct |
36 ms |
3836 KB |
Output is correct |
31 |
Correct |
72 ms |
10708 KB |
Output is correct |