Submission #886785

#TimeUsernameProblemLanguageResultExecution timeMemory
886785Maite_MoraleIntercastellar (JOI22_ho_t1)C++14
100 / 100
397 ms12376 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...