n exploited workers under your command, numbered from. yuan. Under your strict supervision, workers cannot tell each other their salaries. You thought the good days would continue like this, but the workers increasingly felt exploited, so they decided to strike and protest against you!Without the labor of workers, there wouldn't be a luxurious life for you. So you decide to raise their salaries in an appropriate way to stop them from protesting. At first, every worker is unsatisfied. You need to organize several two-person chats to make everyone satisfied, or only one person unsatisfied - at this point, there will be nobody who wants to protest against you with him.To organize a two-person chat, you need to choose two unsatisfiedworkers. x,y , then allow them to tell each other their salaries without penalty temporarily:. , both of the two workers will feel that they have not been mistreated and both will become satisfied.y will realize that he has been treated differently, so you need to increase his salary to. But as an evil capitalist, you want to know at least how much money you need to pay them to achieve your goal.
Today Colin and Eva learned what is exploitation in the course 'Basic Principles of Marxism'. At night, Colin had a dream where he was a poor worker, cruelly exploited by capitalist Eva without realizing it at all... Assuming you are an evil capitalist with n n exploited workers under your command, numbered from 1 1 to n n . The current salary of worker with number i i is a_i a i yuan. Under your strict supervision, workers cannot tell each other their salaries. You thought the good days would continue like this, but the workers increasingly felt exploited, so they decided to strike and protest against you! Without the labor of workers, there wouldn't be a luxurious life for you. So you decide to raise their salaries in an appropriate way to stop them from protesting. At first, every worker is unsatisfied. You need to organize several two-person chats to make everyone satisfied, or only one person unsatisfied - at this point, there will be nobody who wants to protest against you with him. To organize a two-person chat, you need to choose two unsatisfied workers x,y x,y , then allow them to tell each other their salaries without penalty temporarily: if a_x=a_y a x =a y (which means they have the same salary), both of the two workers will feel that they have not been mistreated and both will become satisfied . if a_x>a_y a x >a y , then worker x x will become satisfied. However, worker y y will realize that he has been treated differently, so you need to increase his salary to a_x a x (which means you have to pay him a_x-a_y a x −a y yuan, then let a_y=a_x a y =a x ), and worker y y still remains unsatisfied. Similarly, If a_y > a_x a y >a x then worker y y will become satisfied. However you have to pay worker x x a_y-a_x a y −a x yuan, then let a_x=a_y a x =a y , and worker x x still remains unsatisfied . But as an evil capitalist, you want to know at least how much money you need to pay them to achieve your goal.