이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define x first
#define y second
#define sz(a) (int)a.size()
#define pb push_back
#define int long long
using namespace std;
typedef long long ll;
const int K = 5000;
void solve();
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int t = 1;
//cin >> t;
while (t--)
solve();
return 0;
}
pair <int, int> a[200010];
int pref[200010];
int get(int x) {
int t = 1;
while (x % 2 == 0) {
t *= 2;
x /= 2;
}
return t;
}
void solve() {
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> a[i].x;
a[i].y = get(a[i].x);
}
for (int i = 1; i <= n; ++i)
pref[i] = pref[i - 1] + a[i - 1].y;
int q, x;
cin >> q;
for (int i = 0; i < q; ++i) {
cin >> x;
int t = lower_bound(pref, pref + n + 1, x) - pref - 1;
cout << a[t].x / a[t].y << '\n';
}
}
//923953850098595069
//890909762780980010
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |