#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];
}
int in;
for (int i = 0; i < M; i++) {
cin >> in;
A.push_back(in);
sort(A.begin(), A.end());
int ans = 0;
for (int i = 0; i < (int)A.size(); i++) {
for (int j = i+1; j < (int)A.size(); j++) {
ans = max(ans, (j-i)*D-(A[j]-A[i]));
}
}
cout << (ans>>1); if (ans & 1) cout << ".5";
cout << (i == M-1 ? '\n' : ' ');
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
340 KB |
Output is correct |
2 |
Correct |
23 ms |
336 KB |
Output is correct |
3 |
Correct |
21 ms |
368 KB |
Output is correct |
4 |
Correct |
22 ms |
340 KB |
Output is correct |
5 |
Correct |
21 ms |
372 KB |
Output is correct |
6 |
Correct |
22 ms |
340 KB |
Output is correct |
7 |
Correct |
22 ms |
372 KB |
Output is correct |
8 |
Correct |
22 ms |
360 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
340 KB |
Output is correct |
2 |
Correct |
23 ms |
336 KB |
Output is correct |
3 |
Correct |
21 ms |
368 KB |
Output is correct |
4 |
Correct |
22 ms |
340 KB |
Output is correct |
5 |
Correct |
21 ms |
372 KB |
Output is correct |
6 |
Correct |
22 ms |
340 KB |
Output is correct |
7 |
Correct |
22 ms |
372 KB |
Output is correct |
8 |
Correct |
22 ms |
360 KB |
Output is correct |
9 |
Execution timed out |
1573 ms |
5320 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1555 ms |
320 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1555 ms |
320 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |