Thanos Reaches Earth Problem

Правка en5, от nbg_1609, 2023-11-03 08:17:11

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?

Теги interview, map, codechef, greedy

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en5 Английский nbg_1609 2023-11-03 08:17:11 1086 Tiny change: 'h of the i̟ person.\n' -> 'h of the i person.\n'
en4 Английский nbg_1609 2023-11-03 08:02:06 13
en3 Английский nbg_1609 2023-11-03 07:00:52 13 Tiny change: 'olve this question?' -> 'olve this problem?'
en2 Английский nbg_1609 2023-11-03 06:56:34 26 Tiny change: 'Question:\n\n[Question Link](htt' -> 'Problem:\n\n[Problem Link](htt'
en1 Английский nbg_1609 2023-11-02 16:47:14 169 Initial revision (published)