Submission #995578

#TimeUsernameProblemLanguageResultExecution timeMemory
995578vysniak_grossmeisterIntercastellar (JOI22_ho_t1)C++17
100 / 100
123 ms16632 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n; cin >> n; ll a[n + 1]; for(ll i = 1; i <= n; ++i){ cin >> a[i]; } map<ll, ll>ans; ll idx = 1ll; ll q; cin >> q; ll k[q + 1]; for(ll i = 1; i <= q; ++i){ cin >> k[i]; } ll last = 0ll; for(ll i = 1; i <= n; ++i){ ll L = last + 1ll; ll cnt = 1ll; while(a[i] % 2 == 0){ cnt = cnt * 2ll; a[i] /= 2; } ll R = L + cnt - 1; while(k[idx] >= L and k[idx] <= R){ ans[k[idx]] = a[i]; idx++; } last = R; } for(ll i = 1; i <= q; ++i){ cout << ans[k[i]] << '\n'; } return 0; // 1000 * 1000 | 33 ? }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...