Submission #1319760

#TimeUsernameProblemLanguageResultExecution timeMemory
1319760ghos007Intercastellar (JOI22_ho_t1)C++20
100 / 100
58 ms6856 KiB
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> #define int long long using namespace std; const int INF = 1e18; const int mod = 1e9+7; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector <int> vec(n); for (int i = 0;i < n;i++) { cin >> vec[i]; } vector <int> val(n),cnt(n,1); for (int i = 0;i < n;i++) { val[i] = vec[i]; while (val[i] % 2 == 0) { val[i] /= 2; cnt[i] *= 2; } if (i) { cnt[i] += cnt[i-1]; } } int q; cin >> q; while (q--) { int ind; cin >> ind; int pos = lower_bound(cnt.begin(),cnt.end(),ind) - cnt.begin(); cout << val[pos] << "\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...