제출 #636488

#제출 시각아이디문제언어결과실행 시간메모리
636488danikoynovIntercastellar (JOI22_ho_t1)C++14
100 / 100
106 ms9328 KiB
/** ____ ____ ____ ____ ____ ____ ||l |||e |||i |||n |||a |||d || ||__|||__|||__|||__|||__|||__|| |/__\|/__\|/__\|/__\|/__\|/__\| **/ #include<bits/stdc++.h> #define endl '\n' using namespace std; typedef long long ll; void speed() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } const int maxn = 2e5 + 10; int n, q; ll a[maxn], pref[maxn]; void solve() { cin >> n; for (int i = 1; i <= n; i ++) { cin >> a[i]; ll bit = 0; while(a[i] % ((ll)1 << bit) == 0) bit ++; bit --; pref[i] = pref[i - 1] + ((ll)1 << bit); a[i] /= ((ll)1 << bit); } cin >> q; for (int i = 1; i <= q; i ++) { int l = 0, r = n; ll x; cin >> x; while(l <= r) { int m = (l + r) / 2; if (pref[m] < x) l = m + 1; else r = m - 1; } cout << a[l] << endl; } } int main() { speed(); solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...