제출 #1295405

#제출 시각아이디문제언어결과실행 시간메모리
1295405hssaan_arifIntercastellar (JOI22_ho_t1)C++20
100 / 100
56 ms5588 KiB
#include <bits/stdc++.h> using namespace std; #define endl "\n" #define pb push_back #define int long long #define fi first #define se second 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.pb(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] << endl; } } signed main(){ // freopen("" , "r" , stdin); // freopen("" , "w" , stdout); // cout << setprecision(30); ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int ts = 1; // cin >> ts; while(ts--){ solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...