Блог пользователя nbg_1609

Автор nbg_1609, история, 13 месяцев назад, По-английски

Problem:

Thanos, in his mission to restore the ecological balance in the universe, has reached planet earth. He considers a planet ecologically balanced if more than half of the people on the planet have the same Consumption Capacity. There are N people on planet earth, each having Consumption Capacity C1, C2, ... Cy and Strength S1, S2, ... Sy. Thanos will make earth ecological balanced by killing some people(Possibly None). To kill a person with Strength K, Thanos spends K units of his energy. Thanos, being a conservationist, wants to spend as less energy as possible in the process. Help him determine the minimum energy he should spend to make earth ecologically balanced.

Input: First line of input contains a single integer N denoting the number of people on planet Earth. The second line contains N space separated integers C1, C2... Cy denoting the Consumption Capacity of the person. The third line contains N space separated integers S1, S2. Sy denoting the Strength of the i person.

Output: Output a single integer denoting the minimum energy Thanos spends.

Problem Link

Can anyone explain an approach to solve this problem?

  • Проголосовать: нравится
  • -3
  • Проголосовать: не нравится

»
13 месяцев назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

call the avengers

»
13 месяцев назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

earth is closed today