# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1123746 | Neco_arc | Intercastellar (JOI22_ho_t1) | C++20 | 71 ms | 5448 KiB |
#include <bits/stdc++.h>
#define ll long long
#define name "Intercastellar"
#define fi(i, a, b) for(int i = a; i <= b; ++i)
#define fid(i, a, b) for(int i = a; i >= b; --i)
#define maxn (int) (2e5 + 7)
using namespace std;
int n;
ll s[maxn], a[maxn];
void solve() {
cin >> n;
fi(i, 1, n) {
int x, sl = 1; cin >> x;
while(x % 2 == 0) sl *= 2, x /= 2;
s[i] = s[i - 1] + sl, a[i] = x;
}
int q; cin >> q;
fi(i, 1, q) {
ll x; cin >> x;
int it = lower_bound(s + 1, s + 1 + n, x) - s;
cout << a[it] << '\n';
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
if(fopen(name".inp", "r")) {
freopen(name".inp", "r", stdin);
freopen(name".out", "w", stdout);
}
solve();
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |