#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <vector>
using namespace std;
const int MX = 2e5 + 5;
int n, m, d;
int a[MX], b[MX];
void go() {
for(int j = 0; j < m; j++) {
int ind = -1;
for(int i = 0; i < n; i++) {
if(a[i] > b[j]) {
ind = i;
break;
}
}
if(ind == -1) ind = n;
for(int i = n; i > ind; i--) a[i] = a[i - 1];
a[ind] = b[j];
n++;
long long mx = 0, mn = INT_MAX, cur = 0;
for(int i = 0; i < n - 1; i++) {
cur += a[i + 1] - a[i] - d;
mn = min(mn, cur - mx);
mx = max(mx, cur);
}
cout << max(-(double)mn / 2, (double)0) << "\n";
}
}
int main() {
cin >> n >> m >> d;
for(int i = 0; i < n; i++) cin >> a[i];
for(int i = 0; i < m; i++) cin >> b[i];
sort(a, a + n);
if(n != 0) {
go();
return 0;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
57 ms |
2884 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
57 ms |
2884 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |