#P5085. 大奔的方案
大奔的方案
Description
If A and B are friends, and B and C are also friends, then A, B, and C are all in the same gang.
Now you are given brotherhood relations. Please determine the gang relationships, and then find the new method for pirates to split coins.
Warning: toxic problem.
Of course, you still need to ensure that pirates with smaller numbers receive as many coins as possible, even if it breaks relationships between gangs. (Figure it out yourself.)
Input Format
The first line contains five integers separated by spaces, representing the number of pirates, the number of coins, the minimum approval percentage, the total number of brotherhood relations, and the so-called friendship cost.
The next lines each contain two integers , meaning and have a brotherhood relation (that is, they are in the same gang).
Output Format
Only one line containing integers separated by spaces, representing the final result.
If a pirate dies, output instead.
5 7 50 2 1
1 2
3 2
5 1 1 0 0
Hint
Constraints and Notes
For of the testdata: , , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号