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.
Can anyone explain an approach to solve this problem?
call the avengers
earth is closed today