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>
using namespace std;
#define int long long
#define double long double
#define IO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pii pair<int,int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf push_front
#define all(x) x.begin(),x.end()
#define de(x) cout << #x << ':' << x << '\n';
template<class T> void prt(T l,T r){
while(l!=r) cout << *l << '\n',l++;
cout << '\n';
}
const int N=1e6+5,M=1e9+7,INF=1e18;
signed main(){
IO
int n;cin >> n;
vector<int> a(n),b(n,1);
for(int i=0;i<n;i++){
cin >> a[i];
while(a[i]%2==0){
a[i]/=2;
b[i]*=2;
}
}
int q;cin >> q;
int li=0,x;
while(q--){
cin >> x;
while(b[li]<x){
b[li+1]+=b[li];
li++;
}
cout << a[li] << '\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... |