#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, sum = 0, q;
cin >> q;
while (q--) {
int 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 |
2504 KB |
Output is correct |
4 |
Correct |
190 ms |
1976 KB |
Output is correct |
5 |
Correct |
256 ms |
3944 KB |
Output is correct |
6 |
Correct |
126 ms |
2792 KB |
Output is correct |
7 |
Correct |
263 ms |
4200 KB |
Output is correct |
8 |
Correct |
255 ms |
4080 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 |
324 KB |
Output is correct |
6 |
Correct |
1 ms |
324 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
2 ms |
340 KB |
Output is correct |
9 |
Runtime error |
2 ms |
468 KB |
Execution killed with signal 11 |
10 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
2504 KB |
Output is correct |
4 |
Correct |
190 ms |
1976 KB |
Output is correct |
5 |
Correct |
256 ms |
3944 KB |
Output is correct |
6 |
Correct |
126 ms |
2792 KB |
Output is correct |
7 |
Correct |
263 ms |
4200 KB |
Output is correct |
8 |
Correct |
255 ms |
4080 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 |
324 KB |
Output is correct |
14 |
Correct |
1 ms |
324 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
2 ms |
340 KB |
Output is correct |
17 |
Runtime error |
2 ms |
468 KB |
Execution killed with signal 11 |
18 |
Halted |
0 ms |
0 KB |
- |