#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 << 31);
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 |
3 ms |
212 KB |
Output is correct |
5 |
Correct |
3 ms |
328 KB |
Output is correct |
6 |
Correct |
3 ms |
212 KB |
Output is correct |
7 |
Correct |
3 ms |
212 KB |
Output is correct |
8 |
Incorrect |
3 ms |
212 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
3 ms |
212 KB |
Output is correct |
5 |
Correct |
3 ms |
328 KB |
Output is correct |
6 |
Correct |
3 ms |
212 KB |
Output is correct |
7 |
Correct |
3 ms |
212 KB |
Output is correct |
8 |
Incorrect |
3 ms |
212 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1558 ms |
440 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1558 ms |
440 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |