Submission #1026216

#TimeUsernameProblemLanguageResultExecution timeMemory
1026216overwatch9Intercastellar (JOI22_ho_t1)C++17
35 / 100
2094 ms2468 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]; int q; cin >> q; while (q--) { ll x; cin >> x; ll cnt = 0; ll ans = 1; for (int i = 1; i <= n; i++) { ll tp = 1; ll tp2 = a[i]; while (tp2 % 2 == 0) { tp *= 2; tp2 /= 2; } cnt += tp; if (cnt >= x) { ans = tp2; break; } } cout << ans << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...