#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, m, D;
cin >> n >> m >> D;
vector<int> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
vector<int> b(m);
for (int i = 0; i < m; ++i) {
cin >> b[i];
}
if (n > 0) {
sort(a.begin(), a.end());
for (int i = 0; i < m; ++i) {
a.insert(lower_bound(a.begin(), a.end(), b[i]), b[i]);
ll ans = numeric_limits<ll>::min(), mx = numeric_limits<ll>::min();
for (int k = size(a) - 1; k >= 0; --k) {
mx = max(mx, 1LL * D * k - a[k]);
ans = max(ans, mx - 1LL * D * k + a[k]);
}
if (ans % 2 == 0) {
cout << ans / 2 << ' ';
} else {
cout << ans / 2 << ".5 ";
}
}
} else {
assert(false);
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
35 ms |
1876 KB |
Output is correct |
10 |
Correct |
34 ms |
3768 KB |
Output is correct |
11 |
Correct |
32 ms |
3780 KB |
Output is correct |
12 |
Correct |
42 ms |
3788 KB |
Output is correct |
13 |
Correct |
22 ms |
3344 KB |
Output is correct |
14 |
Correct |
31 ms |
3772 KB |
Output is correct |
15 |
Correct |
34 ms |
3124 KB |
Output is correct |
16 |
Correct |
26 ms |
3772 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
19 ms |
2016 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
19 ms |
2016 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |