#include <bits/stdc++.h>
using namespace std;
#define int long long
int N, M, D;
vector<int> A;
int ans = 0;
signed main() {
ios::sync_with_stdio(false), cout.tie(0), cin.tie(0);
cin >> N >> M >> D;
A.resize(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
sort(A.begin(), A.end());
int in;
for (int i = 0; i < M; i++) {
cin >> in;
auto it = lower_bound(A.begin(), A.end(), in);
A.insert(it, in);
int cur = 0;
for (int i = (int)A.size()-2; i >= 0; i--) {
int deltamin = D+A[i]-A[i+1];
cur = max(cur + deltamin, 0ll);
ans = max(cur, ans);
}
cout << (ans>>1); if (ans & 1) cout << ".5";
cout << (i == M-1 ? '\n' : ' ');
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
336 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 |
356 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
336 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 |
356 KB |
Output is correct |
9 |
Correct |
39 ms |
5316 KB |
Output is correct |
10 |
Correct |
40 ms |
5328 KB |
Output is correct |
11 |
Correct |
29 ms |
5332 KB |
Output is correct |
12 |
Correct |
49 ms |
5336 KB |
Output is correct |
13 |
Correct |
24 ms |
4804 KB |
Output is correct |
14 |
Correct |
35 ms |
5256 KB |
Output is correct |
15 |
Correct |
37 ms |
4680 KB |
Output is correct |
16 |
Correct |
26 ms |
5328 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1567 ms |
1204 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1567 ms |
1204 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |