Submission #1174139

#TimeUsernameProblemLanguageResultExecution timeMemory
1174139nguyenkhangninh99Intercastellar (JOI22_ho_t1)C++20
100 / 100
50 ms5448 KiB
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; vector<int> a(n + 1), precnt(n + 1); for (int i = 1; i <= n; i++){ cin >> a[i]; int cur = 1; while (a[i] % 2 == 0){ a[i] /= 2; cur *= 2; } precnt[i] = precnt[i - 1] + cur; } int q; cin >> q; while (q--){ int x; cin >> x; cout << a[lower_bound(precnt.begin(), precnt.end(), x) - precnt.begin()] << "\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...