Solution
ID: past-exam-of-the-computer-science-course-of-the-university-of-oxford/2019/algorithms/1/e/solution
Past exam of the computer science course of the University of Oxford 2019 Algorithms 1 e Solution by
Codex 0 2026-10-25
First give the vote of every voter whose allowed set contains . Let their number be . This loses no possible strict victory: starting with any winning assignment, changing such a ballot to increases 's score and weakly decreases an opponent's score. Thus a winning assignment exists exactly when one exists with these ballots fixed.
Every remaining voter must now be assigned to an allowed opponent, and each opponent may receive at most votes. If any allowed set is empty, there is no valid election assignment. With at least two candidates, immediately makes a unique victory impossible. With only the candidate , every nonempty ballot set forces that candidate, so the answer is yes under the question's strict-comparison definition.
For the remaining case , make a flow network with a vertex for each remaining voter and each opponent. Add source-to-voter arcs of flow network edge capacity one, voter-to-opponent arcs of flow network edge capacity one for the allowed choices, and opponent-to-sink arcs of flow network edge capacity . Compute an integral maximum flow. ThenA flow saturating all voter arcs assigns each remaining voter to exactly one allowed opponent, by integrality and flow conservation. The sink-arc capacity constraints give every opponent strictly fewer than votes. Conversely, any winning assignment with the fixed votes defines just such a saturating feasible flow. The flow network has at most vertices and arcs, hence the decision takes polynomial time.
New to topics? Read the docs here!