제출 #783768

#제출 시각아이디문제언어결과실행 시간메모리
783768borisAngelovIntercastellar (JOI22_ho_t1)C++17
100 / 100
64 ms9220 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 200005; int n; pair<int, long long> preffix[maxn]; void fastIO() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } int main() { fastIO(); cin >> n; for (int i = 1; i <= n; ++i) { int number; cin >> number; int new_number = number; while (new_number % 2 == 0) { new_number /= 2; } preffix[i].first = new_number; preffix[i].second = preffix[i - 1].second + number / new_number; } int q; cin >> q; for (int i = 1; i <= q; ++i) { long long x; cin >> x; int l = 1; int r = n; while (l <= r) { int mid = (l + r) / 2; if (x > preffix[mid].second) { l = mid + 1; } else { r = mid - 1; } } cout << preffix[l].first << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...