import java.util.*;
public class timovi
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt(), m = sc.nextInt();
int a[] = new int[n];
int b[] = new int[m];
for(int i = 0; i < n; i++)
{
a[i] = sc.nextInt();
}
for(int i = 0; i < m; i++)
{
b[i] = sc.nextInt();
}
Arrays.sort(a);
Arrays.sort(b);
int l = 0, r = 1000000000;
int ans = r;
while(l <= r)
{
int mid = (l + r) / 2;
int pos = 0;
boolean condition = true;
for(int i = 0; i < Math.min(n, m); i++)
{
if(pos == Math.max(m, n))
{
condition = false;
break;
}
if(n == Math.min(n, m))
{
if(Math.abs(b[pos] - a[i]) <= mid)
{
pos++;
continue;
}
}
if(m == Math.min(n, m))
{
if(Math.abs(a[pos] - b[i]) <= mid)
{
pos++;
continue;
}
}
i--;
pos++;
}
if(condition == true)
{
r = mid - 1;
ans = mid;
}
else
{
l = mid + 1;
}
}
System.out.println(ans);
}
}
Compilation message
cipele.java:2: error: class timovi is public, should be declared in a file named timovi.java
public class timovi
^
1 error