#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n, q, x, a[200001], cnt[200001];
int main() {
cin >> n;
for (int i=1; i<=n; i++){
cin >> a[i];
cnt[i]=1;
while (a[i]%2==0) a[i]/=2, cnt[i]*=2;
cnt[i]+=cnt[i-1];
}
cin >> q;
while (q--){
cin >> x;
ll p=lower_bound(cnt+1, cnt+n+1, x)-cnt;
cout << a[p] << "\n";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
96 ms |
3948 KB |
Output is correct |
4 |
Correct |
251 ms |
2260 KB |
Output is correct |
5 |
Correct |
350 ms |
5532 KB |
Output is correct |
6 |
Correct |
199 ms |
4068 KB |
Output is correct |
7 |
Correct |
372 ms |
5532 KB |
Output is correct |
8 |
Correct |
388 ms |
5536 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
2 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
308 KB |
Output is correct |
8 |
Correct |
2 ms |
340 KB |
Output is correct |
9 |
Correct |
2 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
3 ms |
340 KB |
Output is correct |
12 |
Correct |
3 ms |
316 KB |
Output is correct |
13 |
Correct |
1 ms |
316 KB |
Output is correct |
14 |
Correct |
3 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 |
212 KB |
Output is correct |
3 |
Correct |
96 ms |
3948 KB |
Output is correct |
4 |
Correct |
251 ms |
2260 KB |
Output is correct |
5 |
Correct |
350 ms |
5532 KB |
Output is correct |
6 |
Correct |
199 ms |
4068 KB |
Output is correct |
7 |
Correct |
372 ms |
5532 KB |
Output is correct |
8 |
Correct |
388 ms |
5536 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
2 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
308 KB |
Output is correct |
16 |
Correct |
2 ms |
340 KB |
Output is correct |
17 |
Correct |
2 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
3 ms |
340 KB |
Output is correct |
20 |
Correct |
3 ms |
316 KB |
Output is correct |
21 |
Correct |
1 ms |
316 KB |
Output is correct |
22 |
Correct |
3 ms |
340 KB |
Output is correct |
23 |
Correct |
218 ms |
2940 KB |
Output is correct |
24 |
Correct |
193 ms |
5196 KB |
Output is correct |
25 |
Correct |
431 ms |
8764 KB |
Output is correct |
26 |
Correct |
262 ms |
5468 KB |
Output is correct |
27 |
Correct |
234 ms |
5512 KB |
Output is correct |
28 |
Correct |
457 ms |
9164 KB |
Output is correct |
29 |
Correct |
438 ms |
8704 KB |
Output is correct |
30 |
Correct |
328 ms |
3640 KB |
Output is correct |
31 |
Correct |
447 ms |
9064 KB |
Output is correct |