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.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Note that there are no impossible cases. For , it suffices to place the largest
numbers on the bottom row. For
, it suffices to place the largest
numbers on the main diagonal of the grid. Starting from the
grid, we can achieve each
from
to
by swapping the element on the diagonal with the element on the bottom row.
Comments