Submission #642745

#TimeUsernameProblemLanguageResultExecution timeMemory
642745kdn5549Intercastellar (JOI22_ho_t1)C++17
100 / 100
74 ms9292 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pi; typedef pair<ll,ll> pl; #define eb emplace_back #define all(v) v.begin(),v.end() #define ff first #define ss second const ll mxn=2e5+5; vector<pl> vt; int main() { ios::sync_with_stdio(0); cin.tie(0); ll n; cin>>n; for (int i=1;i<=n;i++) { ll a; cin>>a; ll cnt=1; while (a%2==0) { a/=2; cnt*=2; } vt.eb(a,cnt); } ll q; cin>>q; ll c=0,pos=0; while (q--) { ll x; cin>>x; while (c<n and pos+vt[c].ss<x) { pos+=vt[c].ss; c++; } cout<<vt[c].ff<<'\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...