//Challenge: Accepted
#include <bits/stdc++.h>
using namespace std;
#ifdef zisk
void debug(){cout << endl;}
template<class T, class ... U> void debug(T a, U ... b){cout << a << " ", debug(b...);}
template<class T> void pary(T l, T r) {
while (l != r) cout << *l << " ", l++;
cout << endl;
}
#else
#define debug(...) 0
#define pary(...) 0
#endif
#define ll long long
#define maxn 200005
#define pii pair<int, int>
#define ff first
#define ss second
#define io ios_base::sync_with_stdio(0);cin.tie(0);
ll a[maxn], que[maxn];
int main() {
io
int n;
cin >> n;
for (int i = 0;i < n;i++) cin >> a[i];
int q;
cin >> q;
for (int i = 0;i < q;i++) cin >> que[i];
ll cur = 0, ind = 0;
for (int i = 0;i < q;i++) {
while (ind < n && cur + (a[ind] & (-a[ind])) < que[i]) {
cur += a[ind] & (-a[ind]);
ind++;
}
cout << a[ind] / (a[ind] & (-a[ind])) << "\n";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
15 ms |
2628 KB |
Output is correct |
4 |
Correct |
31 ms |
2916 KB |
Output is correct |
5 |
Correct |
41 ms |
4848 KB |
Output is correct |
6 |
Correct |
22 ms |
3388 KB |
Output is correct |
7 |
Correct |
39 ms |
4996 KB |
Output is correct |
8 |
Correct |
43 ms |
5452 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
316 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
320 KB |
Output is correct |
9 |
Correct |
0 ms |
332 KB |
Output is correct |
10 |
Correct |
0 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
332 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
15 ms |
2628 KB |
Output is correct |
4 |
Correct |
31 ms |
2916 KB |
Output is correct |
5 |
Correct |
41 ms |
4848 KB |
Output is correct |
6 |
Correct |
22 ms |
3388 KB |
Output is correct |
7 |
Correct |
39 ms |
4996 KB |
Output is correct |
8 |
Correct |
43 ms |
5452 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
316 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
1 ms |
332 KB |
Output is correct |
16 |
Correct |
1 ms |
320 KB |
Output is correct |
17 |
Correct |
0 ms |
332 KB |
Output is correct |
18 |
Correct |
0 ms |
332 KB |
Output is correct |
19 |
Correct |
1 ms |
332 KB |
Output is correct |
20 |
Correct |
1 ms |
332 KB |
Output is correct |
21 |
Correct |
1 ms |
332 KB |
Output is correct |
22 |
Correct |
1 ms |
332 KB |
Output is correct |
23 |
Correct |
23 ms |
3436 KB |
Output is correct |
24 |
Correct |
40 ms |
4364 KB |
Output is correct |
25 |
Correct |
53 ms |
8064 KB |
Output is correct |
26 |
Correct |
39 ms |
4980 KB |
Output is correct |
27 |
Correct |
34 ms |
4552 KB |
Output is correct |
28 |
Correct |
65 ms |
8864 KB |
Output is correct |
29 |
Correct |
61 ms |
7912 KB |
Output is correct |
30 |
Correct |
36 ms |
4672 KB |
Output is correct |
31 |
Correct |
78 ms |
8860 KB |
Output is correct |