Editorial for COCI '21 Contest 6 #1 Med


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.

This problem is intended to check whether participants can write their own comparator function for sorting. Assume that the sixth round was also held. A competitor with name x and points bx1,bx2,,bx6 will be ahead of a competitor with name y and points by1,by2,,by6 if and only if bx1+bx2++bx6>by1+by2++by6, or if the sums are equal and x is lexicographically smaller than y.

For each competitor, we can look at the worst and best possible scenario - all competitors except them win 500 points and they get 0 points, and vice versa. For each scenario, we sort the ranking according to the comparator and find the best and worst possible positions for them.

In C++, this can be done by writing a custom comparator function and then using std::sort, while in Python, this can be done by sorting twice with different key functions for list.sort.


Comments

There are no comments at the moment.