17 teams scored 780 points on this task, for a maximum score of 100, an average score of 46 and a median score of 30.
Edoardo is having an hard time maintaining the forum. In particular, the component responsible of sending to the users the notifications about new comments is very slow, so he would like to make it better. The forum can be described as a tree of directories, where each directory may contain other directories and zero or more posts. There are D directories, identified by integers from 0 to D-1, and P posts in total, identified by integers from D to D+P-1. The directory with identifier zero is the root of the tree; this means that every other directory and post is (directly or indirectly) contained in that directory. Edoardo knows that every directory or post with identifier i is directly contained inside the directory with identifier A_i. Since the root directory is not contained in any other directory, we define A_0 to be equal to -1. To make things easier, Edoardo considers only the E events triggered by one user. The j-th event has a type T_j and an identifier ID_j...