# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1201850 | FIFAnoice | Intercastellar (JOI22_ho_t1) | C++20 | 0 ms | 0 KiB |
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5;
int index[N+1], value[N+1], n, q;
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n;
for(int i = 1; i <= n; ++i){
int x; cin >> x;
int cnt = 1;
while(!(x & 1)){
x >>= 1;
cnt <<= 1;
}
index[i] = index[i-1] + cnt;
value[i] = x;
}
cin >> q;
while(q--){
int x; cin >> x;
auto it = lower_bound(index + 1, index + n + 1, x);
cout << value[it - index] << '\n';
}
return 0;
}
/*
4
14
9
8
12
6
2
3
5
7
11
13
*/