Editorial for DMOPC '23 Contest 1 P1 - Peak Grid


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Author: yzhao123

Note that there are no impossible cases. For K = 1, it suffices to place the largest N numbers on the bottom row. For K = N, it suffices to place the largest N numbers on the main diagonal of the grid. Starting from the K = 1 grid, we can achieve each K from 2 to N by swapping the element on the diagonal with the element on the bottom row.


Comments

There are no comments at the moment.