Gossip Spreading (gossip)

26 teams scored 2110 points on this task, for a maximum score of 100, an average score of 81 and a median score of 100.

Highlights

  1. Volta, Milano is the institute with the most points (200).
  2. Lombardia is the region with the most points (780).

Statement

A class has N students (numbered from 0 to N-1), who are all very petty and always discuss the latest gossip. However, they only talk to their best friends. Student i's best friend is student P_i. Students i and P_i talk every day, telling each other what gossip they have heard the previous day. For jealousy reasons, all P_i values are distinct. Also, it is possible that P_i=i, which means student i has no best friend. Note that the best friend relationship is not necessarily mutual, but when two students talk, both of them will tell the gossips to the other. For example, there could be a class of 4 students where P_0=1, P_1=2, P_2=0, and P_3=3. The best friend relationships are displayed in the following figure. In this case, student 0 tells the gossips he heard the previous day to student 1 and student 2, since his best friend is student 1 and he is the best friend of student 2...