Submission #970246

#TimeUsernameProblemLanguageResultExecution timeMemory
970246njoopIntercastellar (JOI22_ho_t1)C++17
100 / 100
66 ms9300 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; ll n, q, x, idx, a[200010], ans[200010]; ll div2(ll pc) { int i; for(i=1; pc%2 == 0; i++) { pc /= 2; } return pow(2, i-1); } int main() { cin.tie(0)->sync_with_stdio(0); cin >> n; for(int i=1; i<=n; i++) { cin >> a[i]; ans[i] = div2(a[i]); ans[i] += ans[i-1]; } cin >> q; while(q--) { cin >> x; idx = lower_bound(ans+1, ans+n+1, x) - ans; cout << a[idx]/(ans[idx]-ans[idx-1]) << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...