#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 = 1e18, 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(-(long double)mn / 2, (long 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);
go();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1551 ms |
1432 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1551 ms |
1432 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |