Submission #862223

#TimeUsernameProblemLanguageResultExecution timeMemory
862223arbuzickIntercastellar (JOI22_ho_t1)C++17
25 / 100
44 ms6484 KiB
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; vector<int> a(n); vector<pair<int, int>> b(n); for (int i = 0; i < n; ++i) { cin >> a[i]; int pw = 0; while (a[i] % (1 << (pw + 1)) == 0) { pw++; } b[i] = {1 << pw, a[i] / (1 << pw)}; } vector<long long> pr_cnt(n + 1); for (int i = 0; i < n; ++i) { pr_cnt[i + 1] = pr_cnt[i] + b[i].first; } int q; cin >> q; while (q--) { int x; cin >> x; x--; int pos = upper_bound(pr_cnt.begin(), pr_cnt.end(), x) - pr_cnt.begin() - 1; cout << b[pos].second << '\n'; } } signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int t = 1; // cin >> t; while (t--) { solve(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...