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 MAX 500005
#define oo 1e18
#define mod 1000000007
#define pll pair<long long,long long>
#define F first
#define S second
#define vll vector<long long>
#define vvll vector<vll>
using namespace std;
typedef long long ll;
ll n,m,a[MAX],d[MAX],q,a1;
int main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];ll s=1;
while(a[i]%2==0){
a[i]/=2;s*=2;
}
d[i]=d[i-1]+s;
}cin>>q;ll i=1;
while(q--){
cin>>a1;
while(a1>d[i])i++;
cout<<a[i]<<"\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... |