#P2301. 就是干!
就是干!
Description
Seeing the massive army of teachers marching toward the computer lab, the LOI students decided to use their own strength to defend their good friend Loidc. Now everyone must choose their weapons—two wooden sticks. One is for long-range throwing, and the other is for close-quarters combat. Everyone wants the best, but that is impossible. To make most people satisfied and reduce conflict, cony designed a “conflict index.” This index is the sum of each person’s discomfort index, and the discomfort index is , where are the lengths of the two sticks.
Cony decides to minimize the conflict index, so he comes to you for help and hopes you can tell him the minimum possible conflict index.
Input Format
The first line contains two integers .
It means there are people and sticks.
Then follow numbers representing each stick (it is guaranteed that a solution exists).
Output Format
A single number: the minimum conflict index.
5 2
3
1
4
5
8
5
Hint
Constraints: .
Translated by ChatGPT 5
京公网安备 11011102002149号