#K66092. Warden's Stone Transformation

    ID: 32343 Type: Default 1000ms 256MiB

Warden's Stone Transformation

Warden's Stone Transformation

You are given several test cases. In each test case, there are N stones with assigned integer values. The warden allows you to perform a transformation on these stones. In one transformation, you can change the value on any stone. Your goal is to make all stone values equal so as to minimize the difference between the highest-valued stone and the lowest-valued stone. In other words, if after transformation the values become \(A'_1, A'_2, \dots, A'_N\), you need to achieve:

[ \min (\max_i A'_i - \min_i A'_i)]

Since you are allowed to change every stone's value arbitrarily, it is always possible to transform all stones to a common value. Therefore, the minimum possible difference is 0.

Note: You must read from standard input and output the answer for each test case to standard output.

inputFormat

The input begins with an integer T representing the number of test cases. For each test case:

  • The first line contains an integer N indicating the number of stones.
  • The second line contains N space-separated integers representing the values on the stones.

All input is given via standard input.

outputFormat

For each test case, output a single line containing one integer: the minimum possible difference between the highest and lowest stone values after applying the transformations. Since the transformation can make all stone values equal, the answer is always 0.

All output should be printed to standard output.

## sample
3
5
10 20 30 40 50
3
1 10 100
4
2 4 8 16
0

0 0

</p>