Desk ordering (desk)

29 teams scored 1865 points on this task, for a maximum score of 100, an average score of 64 and a median score of 60.

Highlights

  1. I.S. Fermi MN, Mantova is the institute with the most points (110).
  2. Lombardia is the region with the most points (420).

Statement

William is notoriously messy, and his desk is a wild arrangement of paper piles. As usual, he is starting to write the OIS problems at the very last minute, but there is a major problem: his laptop does not fit on the desk because of all the piles! William's desk is N piles of paper wide (each of them consisting in H_i sheets) and his laptop is L piles wide. In order to fit, the laptop needs to be put horizontally on a contiguous sequence of L piles, which is possible only if the two highest piles among them differ by at most one (the laptop need two supports to stay still). Obviously, the piles contain very important documents he cannot throw away, or even shuffle too much. Thus, the only operation he can do is moving once the top K sheets of a pile to another. What is the minimum number K of sheets he need to move?