Submission #1011942

#TimeUsernameProblemLanguageResultExecution timeMemory
1011942kaopjIntercastellar (JOI22_ho_t1)C++17
100 / 100
53 ms9404 KiB
#include <iostream> #include <vector> #define int long long #define lgm cin.tie(0)->sync_with_stdio(0); using namespace std; signed main() { lgm; int n,x; cin >> n; vector<int> idx={0}; vector<int> val={0}; for (int i=0;i<n;i++) { cin >> x; int cnt=0; while (x%2==0) { x/=2; cnt++; } idx.push_back(idx.back()+(1<<cnt)); val.push_back(x); } int q; cin >> q; while (q--) { cin >> x; int l=1,r=n,m; while (l<r) { m=(l+r)>>1; if (idx[m] >= x) { r=m; } else { l=m+1; } } cout << val[l] << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...