Submission #997878

#TimeUsernameProblemLanguageResultExecution timeMemory
997878yanbIntercastellar (JOI22_ho_t1)C++14
100 / 100
59 ms10940 KiB
#include <bits/stdc++.h> #define int long long using namespace std; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, q; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; cin >> q; vector<int> v2(n, 1); for (int i = 0; i < n; i++) { while (a[i] % 2 == 0) { a[i] /= 2; v2[i] *= 2; } } vector<int> pref(n + 1); for (int i = 0; i < n; i++) pref[i + 1] = pref[i] + v2[i]; while (q--) { int x; cin >> x; x--; cout << a[upper_bound(pref.begin(), pref.end(), x) - pref.begin() - 1] << "\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...