Pile of books (books)

89 teams scored 5567 points on this task, for a maximum score of 100, an average score of 63 and a median score of 81.

Highlights

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

Statement

Davide purchased N books in preparation for the new academic year. He carefully placed them on a table in his study room. After a few minutes, he noticed that the books were arranged in ascending order, with the smallest book at the bottom and the largest book at the top. Realizing this, Davide decided that he preferred the books to be in a different order. He wants to reverse their position, so the largest book is at the bottom and the smallest book is at the top. Davide can perform the following operation a maximum of T times: he can remove K books from the top of pile A and place them, in the same order, on top of pile B (he may choose to utilize a new empty pile, if desired). The cost of the operation will be 1 if the movement of books results in pile A having less books than pile B prior to the movement, and 0 otherwise. Help Davide to reverse the order of the books while minimizing the total cost.