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<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#include<cctype>
#include<sstream>
using namespace std;
typedef long long l;
l n,m;
l leftt[99999];
l rightt[99999];
l ans=-1;
int main(void)
{
cin >> n >> m;
for(int i=0;i<n;i++) cin >> leftt[i];
for(int i=0;i<m;i++) cin >> rightt[i];
sort(leftt,leftt+n);
sort(rightt,rightt+m);
for(l i=0;i<n;i++)
{
l temp=99999;
for(l j=0;j<m;j++)
{
if((abs(leftt[i]-rightt[j]))<temp) temp=abs(leftt[i]-rightt[j]);
}
ans=temp;
}
cout << ans << endl;
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... |