CF1986E Beautiful Array

Description

You are given an array of integers $ a_1, a_2, \ldots, a_n $ and an integer $ k $ . You need to make it beautiful with the least amount of operations. Before applying operations, you can shuffle the array elements as you like. For one operation, you can do the following: - Choose an index $ 1 \leq i \leq n $ , - Make $ a_i = a_i + k $ . The array $ b_1, b_2, \ldots, b_n $ is beautiful if $ b_i = b_{n - i + 1} $ for all $ 1 \leq i \leq n $ . Find the minimum number of operations needed to make the array beautiful, or report that it is impossible.

Input Format

N/A

Output Format

N/A

Explanation/Hint

In the first set of input data, the array is already beautiful. In the second set of input data, you can shuffle the array before the operations and perform the operation with index $ i = 1 $ for $ 83966524 $ times. In the third set of input data, you can shuffle the array $ a $ and make it equal to $ [2, 3, 1] $ . Then apply the operation with index $ i = 3 $ to get the array $ [2, 3, 2] $ , which is beautiful. In the eighth set of input data, there is no set of operations and no way to shuffle the elements to make the array beautiful. In the ninth set of input data, the array is already beautiful.