Submission #527319

#TimeUsernameProblemLanguageResultExecution timeMemory
527319ac2huIntercastellar (JOI22_ho_t1)C++14
100 / 100
87 ms8908 KiB
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { iostream::sync_with_stdio(false); cin.tie(nullptr);cout.tie(nullptr); int n;cin >> n; vector<int> a(n); for(auto &e : a)cin >> e; vector<int> num(n); for(int i = 0;i<n;i++){ int c = 0; while(a[i]%2 == 0){ c++; a[i] /= 2; } num[i] = (1 << c); } // for(auto e : a) // cout << e << " "; // cout << "\n"; for(int i = 1;i<n;i++) num[i] += num[i - 1]; // for(auto e : num) // cout << e << " "; // cout << "\n"; int q;cin >> q; while(q--){ int c;cin >> c; auto x = lower_bound(num.begin(),num.end(),c) - num.begin(); cout << a[x] << "\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...