제출 #1307507

#제출 시각아이디문제언어결과실행 시간메모리
1307507ikkyuIntercastellar (JOI22_ho_t1)C++20
100 / 100
55 ms5628 KiB
#include <bits/stdc++.h> #define int long long using namespace std; const int N = 3e5 + 5, M = 1e9 + 7, LG = 20; int n , A[N] , x , q; void solve(){ cin >> n; vector<int> s(1 , 0); for (int i=1 ; i<=n ; i++){ cin >> x; int cn = 1; while(!(x&1)){ cn *= 2; x /= 2; } s.push_back(s.back() + cn); A[i] = x; } cin >> q; while(q--){ cin >> x; int l = 0 , r = s.size(); while(l+1 < r){ int m = (l+r)>>1; if (s[m] < x){ l = m; }else{ r = m; } } cout << A[l+1] << "\n"; } } signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...