Editorial for TLE '16 Contest 6 (Mock CCC) S1 - Writing the CCC


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.

Author: ZQFMGB12

For the first two subtasks (worth 10/15 points), we simply iterate through all of the problems for each problem type, in order. Whenever a problem matches with a type, output its index.

Time Complexity: \mathcal{O}(NT)

For the final subtask, we use a map to keep track of the preference order for all of the problem types. Then, for each problem, we form a pair with the first number specifying the index of the problem's type, followed by the actual index of the problem. Then, we sort the pairs in increasing order, sorting the first number of the pairs before the second. Then, we iterate through the pairs and output the second number of each pair.

Time Complexity: \mathcal{O}(N \log N)


Comments

There are no comments at the moment.