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 b_{x1}, b_{x2}, \dots, b_{x6} will be ahead of a competitor with name y and points b_{y1}, b_{y2}, \dots, b_{y6} if and only if b_{x1} + b_{x2} + \dots + b_{x6} > b_{y1} + b_{y2} + \dots + b_{y6}, 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.