Submission #734359

#TimeUsernameProblemLanguageResultExecution timeMemory
734359JosiaIntercastellar (JOI22_ho_t1)C++17
100 / 100
90 ms10856 KiB
#include <bits/stdc++.h> using namespace std; #define int int64_t signed main() { cin.tie(0); ios_base::sync_with_stdio(0); int n; cin >> n; vector<int> a(n); for (int i = 0; i<n; i++) { cin >> a[i]; } vector<pair<int, int>> pieces; // amount, len for (int i=0; i<n; i++) { int len = a[i]; int amount = 1; while (len%2==0) { len = len/2; amount *= 2; } if (pieces.empty()) pieces.push_back({amount, len}); else pieces.push_back({amount+pieces.back().first, len}); } int q; cin >> q; for (int i = 0; i<q; i++) { int x; cin >> x; cout << (*lower_bound(pieces.begin(), pieces.end(), pair<int, int>{x, 0})).second << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...