Editorial for WC '16 Finals J1 - Fencing
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
For each cow from to , we'll need to compute the number of matches that they won. To do so, we can iterate over all cows from to such that , and increment whenever . Overall, we'll be looking for the cow with the largest value. To find that cow, we can keep track of the largest value seen so far (as well as the value of its associated index ), and replace it whenever we come across a new maximum. At the end, we can output that associated cow index .
Comments