Submission #921064

#TimeUsernameProblemLanguageResultExecution timeMemory
921064AnasAAFIntercastellar (JOI22_ho_t1)C++14
100 / 100
75 ms11068 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define endl '\n' #define float double int main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); int n;cin>>n; vector<ll>v(n);for(int i=0;i<n;i++)cin>>v[i]; vector<pair<ll, ll>>vp; for(int i=0;i<n;i++){ ll cnt(1); ll x = v[i]; while(x%2==0){ cnt*=2; x/=2; } vp.push_back({cnt, x}); } vector<ll>pr(n+1); for(int i=1;i<=n;i++)pr[i] = pr[i-1] + vp[i-1].first; //for(int i=0;i<n;i++)cout<<vp[i].first<<" : "<<vp[i].second<<endl; int Q;cin>>Q; while(Q--){ ll x;cin>>x; auto it = lower_bound(pr.begin(), pr.end(), x); cout<<vp[it-pr.begin()-1].second<<endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...