Skip to main content

Posts

Showing posts with the label codechef

Fair Elections Codechef January long challenge 2021 solution || Fair Elections Codechef January 2021 Editorial

 Fair Elections Codechef January long challenge  2021 solution || Fair Elections Codechef January 2021 Editorial - Problem Statement- Elections are coming soon. This year, two candidates passed to the final stage. One candidate is John Jackson and his opponent is Jack Johnson. During the elections, everyone can vote for their favourite candidate, but no one can vote for both candidates. Then, packs of votes which went to the same candidate are formed. You know that for John Jackson, there are  N N  packs containing  A 1 , A 2 , … , A N A 1 , A 2 , … , A N  votes, and for Jack Johnson, there are  M M  packs containing  B 1 , B 2 , … , B M B 1 , B 2 , … , B M  votes. The winner is the candidate that has strictly more votes than the other candidate; if both have the same number of votes, there is no winner. You are a friend of John Jackson and you want to help him win. To do that, you may perform the following operation any number of times (including zero): choose two packs of votes t