#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MAXN = 2e5 + 11;
int n, m, d;
bool can(vector<int>& a, int t){
int x0 = -(1LL << 60);
for(auto x : a){
x0 = max(x - t, x0 + d);
if(x0 > x + t) return false;
}
return true;
}
int solve(vector<int>& a){
sort(a.begin(), a.end());
int lo = 0, hi = 1LL << 60;
while(lo != hi){
int mid = (lo + hi) / 2;
if(can(a, mid)){
hi = mid;
}else{
lo = mid + 1;
}
}
return lo;
}
int32_t main(){
cin >> n >> m >> d; d *= 2;
vector<int> a; for(int i = 0; i < n; i++) { int v; cin >> v; v *= 2; a.push_back(v); }
for(int i = 0; i < m; i++){
int v; cin >> v; v *= 2; a.push_back(v);
sort(a.begin(), a.end());
int ans = solve(a);
cout << ans / 2 << (ans % 2 ? ".5" : "") << ' ';
}
cout << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
212 KB |
Output is correct |
2 |
Correct |
3 ms |
212 KB |
Output is correct |
3 |
Correct |
3 ms |
212 KB |
Output is correct |
4 |
Correct |
4 ms |
212 KB |
Output is correct |
5 |
Correct |
3 ms |
212 KB |
Output is correct |
6 |
Correct |
3 ms |
212 KB |
Output is correct |
7 |
Correct |
3 ms |
212 KB |
Output is correct |
8 |
Correct |
3 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
212 KB |
Output is correct |
2 |
Correct |
3 ms |
212 KB |
Output is correct |
3 |
Correct |
3 ms |
212 KB |
Output is correct |
4 |
Correct |
4 ms |
212 KB |
Output is correct |
5 |
Correct |
3 ms |
212 KB |
Output is correct |
6 |
Correct |
3 ms |
212 KB |
Output is correct |
7 |
Correct |
3 ms |
212 KB |
Output is correct |
8 |
Correct |
3 ms |
212 KB |
Output is correct |
9 |
Correct |
312 ms |
3988 KB |
Output is correct |
10 |
Correct |
346 ms |
3904 KB |
Output is correct |
11 |
Correct |
243 ms |
3896 KB |
Output is correct |
12 |
Correct |
356 ms |
3868 KB |
Output is correct |
13 |
Correct |
242 ms |
3504 KB |
Output is correct |
14 |
Correct |
296 ms |
3804 KB |
Output is correct |
15 |
Correct |
297 ms |
3392 KB |
Output is correct |
16 |
Correct |
251 ms |
3820 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1592 ms |
480 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1592 ms |
480 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |