Sort the Toy Cars (cars)

318 teams scored 26915 points on this task, for a maximum score of 100, an average score of 85 and a median score of 100.

Highlights

  1. Banfi, Vimercate is the institute with the most points (900).
  2. Lombardia is the region with the most points (5615).

Statement

Baby Bob has a set of N toy racing cars. Each toy car has a number printed on its top. Each number is between 1 and N, inclusive, and the numbers are unique, that is, there are no two cars with the same number printed on them. Baby Bob has lined up all N toy cars in a single line in some order. The car at position i (0 < i < N) has the number P_i printed on it. Now he wants to sort his toy cars in increasing order of their numbers. For this, he can perform the following operation any number of times (possibly zero): (1) Take the toy car from the end of the line and put it to the front. Formally, if the cars in the line have the numbers P_0, P_1, …, P_N-2, P_N-1 printed on them, then after performing this operation once, the cars will be in the following order: P_N-1, P_0, P_1, …, P_N-2. For example, suppose that there are 3 toy cars in the line with the numbers 3, 1, 2 printed on them (in this order). After performing the operation once, the order of the cars will be 2, 3, 1...