제출 #1309329

#제출 시각아이디문제언어결과실행 시간메모리
1309329g4yuhgIntercastellar (JOI22_ho_t1)C++20
100 / 100
52 ms6928 KiB
#include<bits/stdc++.h> typedef long long ll; #define fi first #define se second #define pii pair<ll,ll> #define N 200005 #define endl '\n' using namespace std; ll n, a[N], pf[N], c[N], q; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 1; i <= n; i ++) { cin >> a[i]; c[i] = 0; ll u = a[i], cnt = 0; while (u % 2 == 0) { u /= 2; cnt ++; } c[i] = (1LL << cnt); pf[i] = pf[i - 1] + c[i]; a[i] = u; } cin >> q; /*for (int i = 1; i <= n; i ++) { cout << pf[i] << " " << a[i] << endl;; } cout << endl;*/ for (int i = 1; i <= q; i ++) { ll u; cin >> u; auto it = lower_bound(pf + 1, pf + 1 + n, u) - pf; //cout << "u " << u << " " << it << endl; cout << a[it] << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...