-
Notifications
You must be signed in to change notification settings - Fork 2
gerrymandering
bradendubois edited this page Oct 7, 2021
·
7 revisions
ID: gerrymandering
Difficulty: 1.6
CPU Time: 2 seconds
Memory: 1024 MB
For each precinct, add a and b to totals of votes corresponding to district d. After this, go through each district from 1 to D, and for each district, the winner is the one with the most votes. The wasted votes for the winner are the votes they received, minus (the total votes for either party / 2 + 1); the wasted votes for the loser are all votes cast for the loser. Store these wasted votes in tallies for votes wasted on each respective candidate. After processing all districts, output |Wa - Wb| / V.