Police Investigation 2 (police2)

84 teams scored 5810 points on this task, for a maximum score of 100, an average score of 69 and a median score of 67.

Highlights

  1. ITI Planck, Villorba is the institute with the most points (310).
  2. Veneto is the region with the most points (900).

Statement

After managing to escape from the police in Terror Street, William is again hiding from them, this time in Crime Avenue. Crime Avenue is structured similarly to Terror Street, and consists of N houses numbered from 0 to N-1. William knows how the police works! They are searching for him going house by house: if William is not found in the i-th house, the people living there will be interrogated until they reveal to the officers that William may be hiding in house V_i. The police will then go there, and repeat the search. It's easy to prove that, no matter the hints of the inhabitants, the police will eventually reach an already visited house and therefore start looping! When the police notices that they are going in a loop, they stop and restart from a new, unvisited house. Eventually, the police will visit every house in the street. William wants to know how long is the longest loop the police will stumble upon.