Official
Overall Editorial by evima
HintsA - All Winners
Hint 1
It's difficult to consider all match pairings and results simultaneously. Let's think about increasing the number of players who win all their games while avoiding contradictions as much as possible, and adjust the pairings and results later.Hint 2
Think about the number of perfect record prize winners that can be produced from each team.Hint 3
In each match, the $M$ players who lose cannot win the perfect record prize.Hint 4
For any two teams, the total number of perfect record prize winners from those teams is at most $M$.Hint 5
Consider the upper bound on the number of perfect record prize winners that satisfies this condition. If we can adjust the match results to achieve this upper bound, that will be our answer.B - Swap If Equal Sum
Hint 1
Consider what operations are actually possible in the sample cases.Hint 2
One approach is to write a brute force solution and experiment to see when it fails.Hint 3
Operations can be performed in reverse order to restore the sequence to its original state.Hint 4
When we can change $A$ → $X$ and $X$ → $B$, we can make $A$ match $B$ by doing $A$ → $X$ → $B$.Hint 5
Pay attention to corner cases and exceptions.C - Destruction of Walls
Hint 1
It becomes easier to think about (and creates a diagram that relatively many people are familiar with) if we replace rooms with lattice points and walls with edges.Hint 2
To move from the top-left room to the bottom-right room, we need to destroy at least $H+W-2$ walls.Hint 3
When $K \lt H+W-2$, the condition cannot be satisfied. When $K=H+W-2$, the condition is to choose walls that form a shortest path from the top-left room to the bottom-right room. What about when $H+W-1 \leq K$?Hint 4
When $K=H+W-1$, we choose one extra wall in addition to the case when $K=H+W-2$. What about when $K=H+W$?Hint 5
We consider cases:- Pattern of moving with $H+W-2$ walls + choosing 2 extra walls
- Pattern of moving with $H+W$ walls