#P8826. [传智杯 #3 初赛] 游戏(征集数据)
[传智杯 #3 初赛] 游戏(征集数据)
Description
Qingzhengyu is an unbeaten player in the game “Chilan Xianye”. One day, he encountered the following game:
You are given an array of length . Also define as the number of bits in the binary representation of .
Each time, Qingzhengyu can perform one of the following two operations:
-
Choose two numbers , and it must satisfy . Delete either one of them from the array, with cost .
-
Choose two numbers , and it must satisfy . Delete either one of them from the array, with cost .
You want to know the minimum total cost to delete numbers until only one number remains in the array.
Input Format
The first line contains an integer , which is the size of the array.
The second line contains two integers , with meanings as described above.
The third line contains integers, describing the array .
Output Format
Output one integer in one line, representing the minimum cost.
4
5 10
1 2 3 4
20
Hint
For of the testdata, .
For another of the testdata, the elements in form a permutation of .
For of the testdata, , , and all elements in are distinct.
Translated by ChatGPT 5
京公网安备 11011102002149号