제출 #1182764

#제출 시각아이디문제언어결과실행 시간메모리
1182764dima2101Intercastellar (JOI22_ho_t1)C++20
100 / 100
246 ms5400 KiB
#include <bits/stdc++.h> #define int long long std::pair<int, int> cnt1(int num, int cnt) { if (num % 2 != 0) { return {num, cnt}; } return cnt1(num / 2, cnt * 2); } int32_t main() { int n; std::cin >> n; std::vector<std::pair<int, int>> all; for (int i = 0; i < n; i++) { int x; std::cin >> x; all.push_back(cnt1(x, 1)); } int q; std::cin >> q; int now = 0; int l = 0; while (q--) { int x; std::cin >> x; while (now + all[l].second < x) { now += all[l++].second; } std::cout << all[l].first << std::endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...