#P10156. [LSOT-2] 胜者组
[LSOT-2] 胜者组
Background
Does getting into the winners bracket count as winning...
At least, people say so.
Problem Description
After NOIP ends, Xiao H's school wants to decide to kick out some students and make them go back to regular classes.
Specifically, the school has students in total, and it keeps at most slots for studying informatics.
The students in the school form small groups. Student belongs to group .
Each time, you may choose two students in the same group to attend regular classes. If you make students attend regular classes, the students will produce dissatisfaction of . Here is a constant given at the beginning of the input.
You need to minimize the total dissatisfaction, or report that it is impossible to keep no more than students studying informatics.
Input Format
The first line contains four positive integers .
The next two lines each contain integers, representing and , respectively.
Output Format
Output one integer in one line, representing the minimum total dissatisfaction. Or output Impossible if there is no solution.
6 2 2 3
2 5 7 2 5 7
1 1 2 1 2 1
25
Hint
Sample explanation:
Choose and to attend regular classes. The dissatisfaction is $(2 + 5 + 3 \times |1 - 2|) + (2 + 7 + 3 \times |4 - 6|) = 25$.
Note that a student cannot be chosen more than once.
"This problem uses bundled testdata."
- .
- .
- .
- .
- no special properties.
Constraints: for all testdata, , , .
Translated by ChatGPT 5