This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//JOI 2022 Final Round
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> a(n);
for(int i=0; i<n; i++){
cin >> a[i];
}
int q;
cin >> q;
int cnt=0;
int length=0;
int j=0;
for(int i=0; i<q; i++){
int x;
cin >> x;
while(cnt<x){
int anz=1;
while(a[j]%2==0){
anz*=2;
a[j]/=2;
}
cnt+=anz;
length=a[j];
j++;
}
cout << length << "\n";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |