1
2 5 10
1 9
Also, after thinking about binary search for this problem, I think this would be the correct approach:
int first_smaller(int x) // returns first smaller number than x in A[]
int first_biggereq(int x) //returns first bigger or equal number than x in A[]
ans = INFINITY
sort A[]
for each x in B[]:
ans = min(ans, min ( x - first_smaller(x), first_biggereq(x) - x ) )
and first_smaller returns -infinity if no such number exists, and first_biggereq returns +infinity if no such number exists.