#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
ll n,m;cin>>n>>m;
vector<ll>a,b;
for(ll i=0;i<n;i++){
ll k;cin>>k;
a.push_back(k);
}
for(ll i=0;i<m;i++){
ll k;cin>>k;
b.push_back(k);
}
if(n>m)swap(a,b);
map<ll,bool>vis;
ll ans=0;
sort(a.begin(),a.end());
sort(b.begin(),b.end());
for(ll i=0;i<min(n,m);i++){
ll mn=1e18;
ll idx=0;
for(ll j=0;j<max(n,m);j++){
if(vis[j])continue;
ll y=abs(a[i]-b[j]);
if(y<mn){
mn=y;
idx=j;
}
}
vis[idx]=1;
ans=max(ans,mn);
}
cout<<ans<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1079 ms |
8028 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1089 ms |
8024 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
312 ms |
496 KB |
Output is correct |
2 |
Execution timed out |
1091 ms |
716 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
588 KB |
Output is correct |
2 |
Execution timed out |
1076 ms |
716 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1088 ms |
588 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1088 ms |
588 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1099 ms |
588 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1080 ms |
7616 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1088 ms |
7436 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1094 ms |
7176 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |