#include<bits/stdc++.h>
using namespace std;
mt19937 rnd(51);
#define ll long long
#define pb push_back
#define ld long double
signed main() {
#ifdef LOCAL
freopen("input.txt", "r", stdin);
#endif // LOCAL
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vector<int> a(n), cnt(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
int now = a[i];
while (now % 2 == 0) {
now /= 2;
cnt[i]++;
}
cnt[i] = (1 << cnt[i]);
}
int j = 0, q;
ll sum = 0;
cin >> q;
while (q--) {
ll x;
cin >> x;
while (sum + cnt[j] < x) {
sum += cnt[j];
j++;
}
cout << a[j] / cnt[j] << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
57 ms |
1864 KB |
Output is correct |
4 |
Correct |
189 ms |
932 KB |
Output is correct |
5 |
Correct |
280 ms |
2252 KB |
Output is correct |
6 |
Correct |
129 ms |
1832 KB |
Output is correct |
7 |
Correct |
276 ms |
2296 KB |
Output is correct |
8 |
Correct |
265 ms |
2356 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
2 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
2 ms |
340 KB |
Output is correct |
12 |
Correct |
2 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
57 ms |
1864 KB |
Output is correct |
4 |
Correct |
189 ms |
932 KB |
Output is correct |
5 |
Correct |
280 ms |
2252 KB |
Output is correct |
6 |
Correct |
129 ms |
1832 KB |
Output is correct |
7 |
Correct |
276 ms |
2296 KB |
Output is correct |
8 |
Correct |
265 ms |
2356 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
2 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
2 ms |
340 KB |
Output is correct |
20 |
Correct |
2 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
2 ms |
340 KB |
Output is correct |
23 |
Correct |
163 ms |
2904 KB |
Output is correct |
24 |
Correct |
130 ms |
4084 KB |
Output is correct |
25 |
Correct |
271 ms |
7252 KB |
Output is correct |
26 |
Correct |
168 ms |
4664 KB |
Output is correct |
27 |
Correct |
143 ms |
4376 KB |
Output is correct |
28 |
Correct |
290 ms |
7632 KB |
Output is correct |
29 |
Correct |
332 ms |
7128 KB |
Output is correct |
30 |
Correct |
214 ms |
3464 KB |
Output is correct |
31 |
Correct |
295 ms |
7520 KB |
Output is correct |