#include <bits/stdc++.h>
using namespace std;
int N, M, D;
int reponse(vector<int> vals) {
int n = vals.size();
int maxicur = 0;
for (int i = 0; i < n; i ++) {
for (int j = i; j < n; j ++) {
maxicur = max(maxicur, (j - i) * D - (vals[j] - vals[i]));
}
}
return maxicur;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin >> N >> M >> D;
vector<int> vals;
for (int i = 0; i < N; i ++) {
int val; cin >> val;
vals.push_back(val);
}
for (int i = 0; i < M; i ++) {
int val; cin >> val;
vals.push_back(val);
sort(vals.begin(), vals.end());
cout << (double) reponse(vals) / 2 << " ";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
340 KB |
Output is correct |
2 |
Incorrect |
24 ms |
332 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
340 KB |
Output is correct |
2 |
Incorrect |
24 ms |
332 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1566 ms |
464 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1566 ms |
464 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |