#include <bits/stdc++.h>
using namespace std;
int N, M, D;
vector<long long> initial;
vector<long long> added;
string half (long long N) {
if (N%2 == 0) {
return to_string(N/2);
} else {
return to_string(N/2)+".5";
}
}
int main () {
cin >> N >> M >> D;
initial.resize(N);
added.resize(M);
for (int i=0; i<N; i++) cin >> initial[i];
for (int i=0; i<M; i++) cin >> added[i];
//sort(added.begin(), added.end());
for (int k=0; k<M; k++) {
initial.push_back(added[k]);
sort(initial.begin(), initial.end());
long long M = 0;
for (int i=0; i<N+k+1; i++) {
for (int j=i+1; j<N+k+1; j++) {
M = max(M, D*(j-i) - (initial[j]-initial[i]));
}
}
cout << half(M) << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
340 KB |
Output is correct |
2 |
Correct |
30 ms |
340 KB |
Output is correct |
3 |
Correct |
32 ms |
340 KB |
Output is correct |
4 |
Correct |
30 ms |
328 KB |
Output is correct |
5 |
Correct |
32 ms |
340 KB |
Output is correct |
6 |
Correct |
33 ms |
340 KB |
Output is correct |
7 |
Correct |
31 ms |
340 KB |
Output is correct |
8 |
Incorrect |
30 ms |
340 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
340 KB |
Output is correct |
2 |
Correct |
30 ms |
340 KB |
Output is correct |
3 |
Correct |
32 ms |
340 KB |
Output is correct |
4 |
Correct |
30 ms |
328 KB |
Output is correct |
5 |
Correct |
32 ms |
340 KB |
Output is correct |
6 |
Correct |
33 ms |
340 KB |
Output is correct |
7 |
Correct |
31 ms |
340 KB |
Output is correct |
8 |
Incorrect |
30 ms |
340 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1532 ms |
2280 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1532 ms |
2280 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |