ZOJ Problem Set - 2068
In China, people use a pair of chopsticks to get food on the table, as we all know, the pair of chopsticks are of the same, but Miss Sundance is a bit different, as a lazy girl, she pluses a spoon to the end of one of her chopsticks, thus she can drink her favorite soup more easily.
But it comes to a serious problem. The lengths of the two chopsticks are now
different. As you may guess, the length of them should be as close as possible.
To make things clearer, for the set of chopsticks with lengths A, B (A <=
B), (A - B) ^ 2 is called the 'badness' of the set.
The first line in the input contains a single integer T, indicating the number of test cases. Each test case contains two lines. The first line begins with an positive integer N1 (1 =< N1 <= 500), the number of chopsticks with spoon, then N1 numbers follow, which denote the lengths of correspondent chopsticks, the second line, describes the normal chopsticks�� lengths, is the same format as the first one. (1 =< N2 <= 500)
Author: LIU, Yaoting
Source: ZOJ Monthly, January 2004