//#include<bits/stdc++.h>
#include<iostream>
#include<bitset>
#include<algorithm>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define pb push_back
#define N 100005
bitset<N> var;
int main(){
lalala;
int n,m;
vector<int> a,b;cin>>n>>m;
for(int i=0;i<n;i++){
int aa;cin>>aa;
a.pb(aa);
}
for(int i=0;i<m;i++){
int bb;cin>>bb;
b.pb(bb);
}
sort(a.begin(),a.end());
sort(b.begin(),b.end());
if(n>m){
swap(n,m);swap(a,b);
}
int l=0,r=1000000000;
while(l<=r){
int mid=(l+r)/2;
int ind=0;
int check=0;
//cout<<l<<" "<<r<<endl;
for(int i=0;i<n;i++){
int ok=0;
while(ind<m){
//cout<<a[i]<<" "<<b[ind]<<" "<<ind<<" "<<i<<endl;
if(abs(a[i]-b[ind])<=mid){
ok=1;
break;
}
ind++;
}
if(ok==0){
check=1;
break;
}
}
if(check)l=mid+1;
else r=mid-1;
}
cout<<l<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
1492 KB |
Output is correct |
2 |
Incorrect |
60 ms |
3096 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
55 ms |
1492 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
440 KB |
Output is correct |
2 |
Incorrect |
2 ms |
340 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Incorrect |
2 ms |
436 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
43 ms |
1240 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
52 ms |
1316 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
41 ms |
1364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |