FR | EN
Quentin L. Meunier
Associate Professor in Computer Science at Sorbonne Université

Problem 1008

After a track and field event, coach Larry Bambel arranges the young players bibs, numbered 1 to 2341 (included), into several crates, so that a number and his triple are never in the same box.

The under-16 bibs, numbered from 1 to 2N, are divided between two piles A and B (N each).
Larry takes the biggest number in the A, the smallest in the B, records their gap (in absolute value) and puts both bibs in a box; he starts again with the remaining bibs and adds the difference to the previous one, and so on until the piles are empty.
Following a similar process, Larry then ranks the under-14 bibs, less numerous than the under-16 bibs, numbered 1 to 2P. The total difference between the two categories (under-16 + under-14) is 2341.

(if there are several solutions, indicate the one which maximizes 2A)



For this problem, I made a program for question 2 only. Note that the statement suggests that the result obtained by summing the absolute values of the differences does not vary according to the distribution of bibs in boxes A and B. We can begin by checking this exhaustively in an increasing manner on the values of N, until the time becomes prohibitive (select_recurse() function). We note of course that this number is N2. Then, it is sufficient to test all the values of N and P that verify the statement.

The program can be found here.





  • 1A: The largest possible number of bibs in a crate is 1756.
  • 2A: There are 92 under-16 and 30 under-14.