제출 #1161948

#제출 시각아이디문제언어결과실행 시간메모리
1161948buraphon_numberoneIntercastellar (JOI22_ho_t1)C++20
25 / 100
33 ms3004 KiB
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(0); int n; vector<pair<int, int>> 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<int> pref(c.size()+1); pref[0] = 0; for(int i=1; i<=c.size(); i++) { pref[i] = pref[i-1] + c[i-1].second; } int q; cin >> q; while(q--) { int 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...