제출 #1121236

#제출 시각아이디문제언어결과실행 시간메모리
1121236sunboiIntercastellar (JOI22_ho_t1)C++17
100 / 100
452 ms11848 KiB
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { int n; cin >> n; vector<int> a(n); vector<pair<int, int>> inter; int l = 1; for (int i = 0; i < n; i++){ cin >> a[i]; int x = a[i]; int next = 1; while(x % 2 == 0){ x /= 2; next *= 2; } inter.push_back({l, x}); l += next; } /*for (auto x : inter){ cout << x.first << ' ' << x.second << endl; } cout << endl;*/ int q; cin >> q; while(q--){ int j; cin >> j; int ini = 1, fin = inter.size(); while(ini < fin){ int m = (ini + fin) / 2; if (inter[m].first <= j){ ini = m + 1; }else fin = m; } ini--; cout << inter[ini].second << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...