제출 #1165986

#제출 시각아이디문제언어결과실행 시간메모리
1165986tvgkIntercastellar (JOI22_ho_t1)C++20
25 / 100
25 ms3980 KiB
#include<bits/stdc++.h> using namespace std; #define task "a" #define se second #define fi first #define ll long long #define ii pair<ll, ll> const long mxN = 2e5 + 7; int n; ll cnt[mxN], a[mxN]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); //freopen(task".INP", "r", stdin); //freopen(task".OUT", "w", stdout); cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; cnt[i] = 1; while (a[i] % 2 == 0) { cnt[i] *= 2; a[i] /= 2; } } int q; cin >> q; int cur = 0, ctr = 0; for (int i = 1; i <= q; i++) { int tmp; cin >> tmp; while (tmp > cur) { ctr++; cur += cnt[ctr]; } cout << a[ctr] << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...