제출 #1197229

#제출 시각아이디문제언어결과실행 시간메모리
1197229aykhnIntercastellar (JOI22_ho_t1)C++20
100 / 100
40 ms3912 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define inf 0x3F3F3F3F const int MXN = 1e5 + 5; int cnt(int x) { int cur = 1; while (!(x & 1)) cur <<= 1, x >>= 1; return cur; } int val(int x) { while (!(x & 1)) x >>= 1; return x; } void _() { int n; cin >> n; int a[n]; for (int &i : a) cin >> i; int q; cin >> q; for (int i = 0, s = 0; q--;) { int x; cin >> x; while (s + cnt(a[i]) < x) s += cnt(a[i++]); cout << val(a[i]) << '\n'; } } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); int t = 1; // cin >> t; while (t--) _(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...