Submission #970487

#TimeUsernameProblemLanguageResultExecution timeMemory
970487jadai007Intercastellar (JOI22_ho_t1)C++14
100 / 100
66 ms9192 KiB
#include<bits/stdc++.h> #define int long long using namespace std; int n,q, ans[200200], arr[200200]; int solve(int n){ int idx = 1; while(n%2==0){ n/=2; idx++; } return pow(2, idx - 1); } signed main(){ cin.tie(nullptr)->sync_with_stdio(false); cin >> n; for(int i = 1; i<=n; ++i) cin >> arr[i]; for(int i = 1; i<=n; ++i){ ans[i] = solve(arr[i]); ans[i]+=ans[i - 1]; } cin >> q; while(q--){ int x; cin >> x; int i = lower_bound(ans+1, ans+1+n, x) - ans; cout << arr[i] / (ans[i] - ans[i - 1]) << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...