#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
iostream::sync_with_stdio(false);
cin.tie(nullptr);cout.tie(nullptr);
int n;cin >> n;
vector<int> a(n);
for(auto &e : a)cin >> e;
vector<int> num(n);
for(int i = 0;i<n;i++){
int c = 0;
while(a[i]%2 == 0){
c++;
a[i] /= 2;
}
num[i] = (1 << c);
}
// for(auto e : a)
// cout << e << " ";
// cout << "\n";
for(int i = 1;i<n;i++)
num[i] += num[i - 1];
// for(auto e : num)
// cout << e << " ";
// cout << "\n";
int q;cin >> q;
while(q--){
int c;cin >> c;
auto x = lower_bound(num.begin(),num.end(),c) - num.begin();
cout << a[x] << "\n";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
22 ms |
3872 KB |
Output is correct |
4 |
Correct |
32 ms |
2116 KB |
Output is correct |
5 |
Correct |
59 ms |
4884 KB |
Output is correct |
6 |
Correct |
41 ms |
3952 KB |
Output is correct |
7 |
Correct |
49 ms |
5056 KB |
Output is correct |
8 |
Correct |
67 ms |
5548 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
292 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
308 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 |
1 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 |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
316 KB |
Output is correct |
14 |
Correct |
1 ms |
328 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
22 ms |
3872 KB |
Output is correct |
4 |
Correct |
32 ms |
2116 KB |
Output is correct |
5 |
Correct |
59 ms |
4884 KB |
Output is correct |
6 |
Correct |
41 ms |
3952 KB |
Output is correct |
7 |
Correct |
49 ms |
5056 KB |
Output is correct |
8 |
Correct |
67 ms |
5548 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
292 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
308 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 |
1 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 |
332 KB |
Output is correct |
21 |
Correct |
1 ms |
316 KB |
Output is correct |
22 |
Correct |
1 ms |
328 KB |
Output is correct |
23 |
Correct |
29 ms |
2720 KB |
Output is correct |
24 |
Correct |
34 ms |
4796 KB |
Output is correct |
25 |
Correct |
67 ms |
8060 KB |
Output is correct |
26 |
Correct |
55 ms |
5184 KB |
Output is correct |
27 |
Correct |
43 ms |
4952 KB |
Output is correct |
28 |
Correct |
87 ms |
8868 KB |
Output is correct |
29 |
Correct |
83 ms |
7892 KB |
Output is correct |
30 |
Correct |
46 ms |
3548 KB |
Output is correct |
31 |
Correct |
84 ms |
8908 KB |
Output is correct |