제출 #828986

#제출 시각아이디문제언어결과실행 시간메모리
828986OAleksaIntercastellar (JOI22_ho_t1)C++14
100 / 100
74 ms12304 KiB
#include <bits/stdc++.h> #define f first #define s second using namespace std; #define int long long signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int tt = 1; //cin >> tt; while(tt--) { int n; cin >> n; vector<int> a(n); for(int i = 0;i < n;i++) cin >> a[i]; vector<int> b(n), c(n); for(int i = 0;i < n;i++) { int x = a[i]; while(x % 2 == 0) x /= 2; b[i] = a[i] / x; c[i] = x; } vector<int> p(n); p[0] = b[0]; for(int i = 1;i < n;i++) p[i] = p[i - 1] + b[i]; int q; cin >> q; for(int i = 1;i <= q;i++) { int x; cin >> x; auto u = lower_bound(p.begin(), p.end(), x) - p.begin(); cout << c[u] << "\n"; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...