Submission #639864

#TimeUsernameProblemLanguageResultExecution timeMemory
639864kdn5549Intercastellar (JOI22_ho_t1)C++17
100 / 100
70 ms9296 KiB
#include<bits/stdc++.h> #define fi first #define se second #define eb emplace_back #define ep emplace #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; typedef pair<int,int> pi; typedef pair<ll,ll> pl; const ll INF=1e18; const ll mod=1e9+7; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n, q; cin >> n; vector<pl> v; for(int i=0;i<n;i++) { int a; cin >> a; ll cnt=1; while(a%2==0) a/=2, cnt*=2; v.eb(cnt, a); } ll i=0, sum=0; cin >> q; while(q--) { ll x; cin >> x; while(i<n and sum+v[i].fi<x) sum+=v[i].fi, i++; cout << v[i].se << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...