Dog Trick Competition 2 (dogtrick2)

11 teams scored 520 points on this task, for a maximum score of 100, an average score of 47 and a median score of 24.

Highlights

  1. L. Scientifico - L. da Vinci, Milano is the institute with the most points (100).
  2. Lombardia is the region with the most points (217).

Statement

RANDy is back at it again, but now he is entering a more advanced dog trick competition with his canine friend, Pompieru. There are K tricks which can be performed in this competition, numbered from 1 to K and Pompieru knows how to perform all of them. However, performing specific tricks one after the other is not always possible: he can only perform trick b right after trick a if he has been trained to do so. RANDy trained Pompieru to perform M pairs of consecutive tricks (A_i, B_i), meaning that Pompieru knows how to perform trick B_i right after trick A_i. The participants are required to perform N tricks T_0, T_1, …, T_N-1 in this specific order. Pompieru will first perform the trick T_0 earning 2 points. When Pompieru finishes performing the trick T_i he will move on to trick T_i + 1. If he can perform the trick T_i + 1 right after T_i he will earn 2 points, otherwise he can choose to perform some (one or more) in between tricks, enabling him to perform T_i + 1...