#K56462. Maximum Height Difference

    ID: 30204 Type: Default 1000ms 256MiB

Maximum Height Difference

Maximum Height Difference

You are given several test cases. For each test case, you are given an integer n denoting the number of candles, followed by n integers representing the heights of the candles. Each candle can be either upright or inverted. When inverted, the candle's height is considered negated. The maximum height difference for a test case is defined as the difference between the maximum possible height and the minimum possible height when each candle is evaluated in either orientation. It can be mathematically shown that the answer is given by \(2 \times h_{\max}\), where \(h_{\max}\) is the maximum height among the candles.

Your task is to compute the maximum height difference for each test case and output the result.

inputFormat

The input is read from standard input and it contains multiple test cases. The first line contains an integer T representing the number of test cases. Each test case is described in two lines:

  • The first line contains an integer n — the number of candles.
  • The second line contains n space-separated integers — the heights of the candles.

outputFormat

For each test case, output a single integer on a new line, which is the maximum height difference. As explained, the answer for each test case is computed as \(2 \times h_{\max}\), where \(h_{\max}\) is the maximum height in that test case.

## sample
3
3
3 2 1
4
5 10 2 8
2
6 6
6

20 12

</p>