제출 #1161950

#제출 시각아이디문제언어결과실행 시간메모리
1161950buraphon_numberoneIntercastellar (JOI22_ho_t1)C++20
100 / 100
52 ms7084 KiB
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(0); long long n; vector<pair<long long , long long>> c; cin >> n; while (n--) { int x, y = 1; cin >> x; while(x%2 == 0) { x /= 2; y *= 2; } c.emplace_back(x, y); } vector<long long> pref(c.size()+1); pref[0] = 0; for(int i=1; i<=c.size(); i++) { pref[i] = pref[i-1] + c[i-1].second; } long long q; cin >> q; while(q--) { long long j; cin >> j; auto it = lower_bound(pref.begin(),pref.end(), j); int idx = it-pref.begin()-1; cout << c[idx].first << '\n'; } return (0); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...