#include <bits/stdc++.h>
using namespace std;
int N, M, D;
vector<int> initial;
vector<int> added;
string half (int 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());
int 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;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
212 KB |
Output is correct |
2 |
Correct |
22 ms |
212 KB |
Output is correct |
3 |
Correct |
23 ms |
212 KB |
Output is correct |
4 |
Correct |
25 ms |
212 KB |
Output is correct |
5 |
Correct |
23 ms |
212 KB |
Output is correct |
6 |
Correct |
23 ms |
212 KB |
Output is correct |
7 |
Correct |
22 ms |
212 KB |
Output is correct |
8 |
Incorrect |
23 ms |
316 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
212 KB |
Output is correct |
2 |
Correct |
22 ms |
212 KB |
Output is correct |
3 |
Correct |
23 ms |
212 KB |
Output is correct |
4 |
Correct |
25 ms |
212 KB |
Output is correct |
5 |
Correct |
23 ms |
212 KB |
Output is correct |
6 |
Correct |
23 ms |
212 KB |
Output is correct |
7 |
Correct |
22 ms |
212 KB |
Output is correct |
8 |
Incorrect |
23 ms |
316 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1543 ms |
1104 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1543 ms |
1104 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |