This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int N,M;
int r[200001], l[200001];
bool check(int T){
int a = 0;
for(int i = 0;i < N; i++){
while(abs(l[a] - r[i]) > T && a < M) a++;
if(a == M)return false;
a++;
}
return true;
}
int main() {
cin >> N >> M;
for(int i = 0;i < N; i++)cin >> r[i];
for(int i = 0;i < M;i++)cin >> l[i];
if(N > M) swap(N,M), swap(r,l);
sort(r,r + N);
sort(l,l + M);
int ans = -1;
for(int b = 1e9 + 1; b >= 1; b /= 2) while(!check(ans + b)) ans += b;
cout << ans + 1 << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |