Submission #970486

#TimeUsernameProblemLanguageResultExecution timeMemory
970486jadai007Intercastellar (JOI22_ho_t1)C++14
35 / 100
11 ms4644 KiB
#include<bits/stdc++.h> #define int long long using namespace std; int n,q, ans[100100], arr[100100]; 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...