Submission #651695

#TimeUsernameProblemLanguageResultExecution timeMemory
651695four_specksIntercastellar (JOI22_ho_t1)C++17
100 / 100
72 ms10792 KiB
#include <bits/stdc++.h> using namespace std; inline namespace { } // namespace void solve(int _test_ = -1) { int n; cin >> n; vector<long> a(n); for (long &x : a) cin >> x; vector<pair<long, long>> b(n); for (int i = 0; i < n; i++) { long tz = __builtin_ctzl(a[i]); b[i] = pair(a[i] >> tz, 1l << tz); } int q; cin >> q; int j = 0; long c = 0; for (int z = 0; z < q; z++) { long d; cin >> d; while (c + b[j].second < d) { c += b[j].second; j++; } cout << b[j].first << '\n'; } } int main() { ios_base::sync_with_stdio(false), cin.tie(NULL); int T_ = 1; // cin >> T_; for (int t_ = 0; t_ < T_; t_++) solve(t_); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...