#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (ll)(r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (ll)(l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;
int main()
{
cin.tie(0) -> sync_with_stdio(false);
int n;
cin >> n;
vector<ll> a(n), b(n+1);
Loop (i,0,n)
cin >> a[i];
Loop (i,0,n)
b[i+1] = b[i] + (a[i] & -a[i]);
int q;
cin >> q;
while (q--) {
int x;
cin >> x;
int i = lower_bound(b.begin(), b.end(), x) - b.begin() - 1;
cout << a[i] / (a[i] & -a[i]) << '\n';
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
316 KB |
Output is correct |
3 |
Correct |
18 ms |
3976 KB |
Output is correct |
4 |
Correct |
29 ms |
2292 KB |
Output is correct |
5 |
Correct |
53 ms |
5576 KB |
Output is correct |
6 |
Correct |
26 ms |
4092 KB |
Output is correct |
7 |
Correct |
47 ms |
5544 KB |
Output is correct |
8 |
Correct |
48 ms |
5732 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
320 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
320 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
316 KB |
Output is correct |
3 |
Correct |
18 ms |
3976 KB |
Output is correct |
4 |
Correct |
29 ms |
2292 KB |
Output is correct |
5 |
Correct |
53 ms |
5576 KB |
Output is correct |
6 |
Correct |
26 ms |
4092 KB |
Output is correct |
7 |
Correct |
47 ms |
5544 KB |
Output is correct |
8 |
Correct |
48 ms |
5732 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
320 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
320 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |