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 main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n>>m;
vector<int> a(n), b(m);
for (auto &x:a) cin>>x;
for (auto &x:b) cin>>x;
if (n>m) swap(n, m), swap(a, b);
int l=0, r=1e9;
while (l<r)
{
int md=(l+r)/2, can=1, idx=0;
for (int i=0; i<n; i++)
{
while (idx<m&&abs(b[idx]-a[i])>md) idx++;
if (idx>=m) can=0;
else idx++;
}
if (can) r=md;
else l=md+1;
}
cout<<l;
}
# | 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... |