제출 #708833

#제출 시각아이디문제언어결과실행 시간메모리
708833sofija6Intercastellar (JOI22_ho_t1)C++14
100 / 100
77 ms9384 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; vector<ll> pref,val; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll n,a,q,x; cin >> n; for (ll i=1;i<=n;i++) { cin >> a; ll cnt=1; while (!(a&1)) { a >>= 1; cnt <<= 1; } if (pref.empty()) pref.push_back(cnt); else pref.push_back(pref[pref.size()-1]+cnt); val.push_back(a); } cin >> q; while (q--) { cin >> x; auto it=lower_bound(pref.begin(),pref.end(),x); cout << val[it-pref.begin()] << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...