#include <bits/stdc++.h>
#define iter(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<ll> c(n + 1), v(n + 1);
for(int i = 1; i <= n; i++){
ll a;
cin >> a;
c[i] = 1;
while(a % 2 == 0){
a /= 2;
c[i] *= 2;
}
v[i] = a;
c[i] += c[i - 1];
}
int q;
cin >> q;
while(q--){
ll x;
cin >> x;
int pos = lower_bound(iter(c), x) - c.begin();
cout << v[pos] << "\n";
}
return 0;
}
# |
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 |
23 ms |
3916 KB |
Output is correct |
4 |
Correct |
32 ms |
2116 KB |
Output is correct |
5 |
Correct |
51 ms |
4872 KB |
Output is correct |
6 |
Correct |
32 ms |
4008 KB |
Output is correct |
7 |
Correct |
52 ms |
5040 KB |
Output is correct |
8 |
Correct |
70 ms |
5516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
308 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
0 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 |
316 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 |
320 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 |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
23 ms |
3916 KB |
Output is correct |
4 |
Correct |
32 ms |
2116 KB |
Output is correct |
5 |
Correct |
51 ms |
4872 KB |
Output is correct |
6 |
Correct |
32 ms |
4008 KB |
Output is correct |
7 |
Correct |
52 ms |
5040 KB |
Output is correct |
8 |
Correct |
70 ms |
5516 KB |
Output is correct |
9 |
Correct |
1 ms |
308 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
0 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 |
316 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 |
320 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 |
28 ms |
2756 KB |
Output is correct |
24 |
Correct |
34 ms |
4808 KB |
Output is correct |
25 |
Correct |
65 ms |
8096 KB |
Output is correct |
26 |
Correct |
50 ms |
5188 KB |
Output is correct |
27 |
Correct |
47 ms |
5072 KB |
Output is correct |
28 |
Correct |
85 ms |
8924 KB |
Output is correct |
29 |
Correct |
85 ms |
7980 KB |
Output is correct |
30 |
Correct |
41 ms |
3640 KB |
Output is correct |
31 |
Correct |
82 ms |
8784 KB |
Output is correct |