#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#define islam_zymchybekov void solve()
#define ios ios::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fr first
#define sc second
#define nl cout<<'\n';
#define int long long
typedef vector<int> vi;
typedef pair<int,int> pi;
const int N= 200005;
int n, q, a[N], x;
int b[N], p[N];
islam_zymchybekov{
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
b[i]=1;
while(a[i]%2==0) {
a[i]/=2;
b[i]*=2;
}
}
for(int i=0;i<n;i++)p[i+1]=p[i]+cnt[i];
cin >> q;
while (q--) {
cin >> x;
int id = lower_bound(p, p + n, x) - p;
id--;
cout<<a[id];nl
}
}
main(){
ios;
int T = 1;
// cin >> T;
while(T--){
solve();
}
//cout<<fixed<<setprecision(10);
//cerr<<"Time:"<<1000*((double)clock())/(double)CLOCKS_PER_SEC<<"ms\n";__int128
}
Compilation message
Main.cpp: In function 'void solve()':
Main.cpp:28:34: error: 'cnt' was not declared in this scope; did you mean 'int'?
28 | for(int i=0;i<n;i++)p[i+1]=p[i]+cnt[i];
| ^~~
| int
Main.cpp: At global scope:
Main.cpp:37:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
37 | main(){
| ^~~~