#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n,m,d;
cin >> n >> m >> d;
vector<int> a(n);
for (int i=0; i<n; ++i){
cin >> a[i];
}
for (int k=0; k<m; ++k){
int pos;
cin >> pos;
a.emplace_back(pos);
sort(a.begin(),a.end());
int maxi = 0;
for (int i=0; i<n+k+1; ++i){
for (int j=i+1; j<n+k+1; ++j){
maxi = max(maxi,d*(j-i)-(a[j]-a[i]));
}
}
cout << maxi/2;
if (maxi&1) cout << ".5";
cout << ' ';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
212 KB |
Output is correct |
2 |
Correct |
22 ms |
332 KB |
Output is correct |
3 |
Correct |
22 ms |
344 KB |
Output is correct |
4 |
Correct |
22 ms |
328 KB |
Output is correct |
5 |
Correct |
21 ms |
340 KB |
Output is correct |
6 |
Correct |
22 ms |
340 KB |
Output is correct |
7 |
Correct |
21 ms |
356 KB |
Output is correct |
8 |
Incorrect |
23 ms |
336 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
212 KB |
Output is correct |
2 |
Correct |
22 ms |
332 KB |
Output is correct |
3 |
Correct |
22 ms |
344 KB |
Output is correct |
4 |
Correct |
22 ms |
328 KB |
Output is correct |
5 |
Correct |
21 ms |
340 KB |
Output is correct |
6 |
Correct |
22 ms |
340 KB |
Output is correct |
7 |
Correct |
21 ms |
356 KB |
Output is correct |
8 |
Incorrect |
23 ms |
336 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1583 ms |
328 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1583 ms |
328 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |