This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define speed ios_base::sync_with_stdio(0); cin.tie(0)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MAX=2e5+10,P=998244353;
const ll INF=0x3f3f3f3f,oo=0x3f3f3f3f3f3f3f3f;
int n,q;
ll a[MAX];
ll pre[MAX];
int main() {
speed;
cin>>n;
pre[0]=0;
for (int i=1;i<=n;i++) {
cin>>a[i];
ll num=0;
while (a[i]%2==0) {
a[i]/=2;
num++;
}
pre[i]=pre[i-1]+(1ll<<num);
}
cin>>q;
while (q--) {
ll x;
cin>>x;
int id=lower_bound(pre+1,pre+n+1,x)-pre;
cout<<a[id]<<"\n";
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |