Submission #1026223

#TimeUsernameProblemLanguageResultExecution timeMemory
1026223overwatch9Intercastellar (JOI22_ho_t1)C++17
100 / 100
87 ms10924 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; vector <ll> a(n+1); for (int i = 1; i <= n; i++) cin >> a[i]; vector <ll> pfx(n+1); vector <ll> val(n+1); ll cnt = 0; for (int i = 1; i <= n; i++) { ll tp = 1; ll tp2 = a[i]; while (tp2 % 2 == 0) { tp *= 2; tp2 /= 2; } cnt += tp; pfx[i] = cnt; val[i] = tp2; } int q; cin >> q; while (q--) { ll x; cin >> x; auto it = lower_bound(pfx.begin(), pfx.end(), x) - pfx.begin(); cout << val[it] << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...