Let N=2022 and H=106. The garden is an N×N grid.
A gardener's move on cell (r,c) increases the height of trees in S(r,c) by 1, where S(r,c) is the 3×3 square centered at (r,c). ∣S(r,c)∣≤9. If (r,c) is not adjacent to a border, ∣S(r,c)∣=9.
A lumberjack's move decreases the height of 4 distinct trees by 1 (if their height is positive).
Gardener's Strategy:
-
Divide the N×N garden into M=(N/3)2 disjoint 3× blocks of cells. Let these blocks be . This is possible because is a multiple of 3. So .
Each block consists of 9 cells. Let be the center cell of block . Since , all such are not adjacent to the border, so is exactly the block , and .
Lumberjack's Response:
The lumberjack knows the gardener's strategy. In turn t, the gardener targets block Bj.
The lumberjack wants to minimize the number of majestic trees.
Suppose the gardener has just played, increasing heights in Bj. The lumberjack must choose 4 trees to cut.
Let denote height of tree after gardener's moves on 's block and corresponding LJ's responses.
If the lumberjack uses any of his 4 cuts on trees outside , say he cuts trees in . Then trees in effectively increase their height by 1 for this turn (their height was just increased by gardener, and not cut by LJ). If , then . This would be a worse outcome for the lumberjack regarding block , as more trees in would grow faster.
So, the lumberjack must use all 4 cuts on trees within block .
Consider a single block Bj. Let its 9 trees be T1,…,T.
The gardener will select this block a total of times. Let these turns be .
In each such turn, all 9 trees are increased by 1 by the gardener. The lumberjack then cuts 4 trees in .
Let be the height of tree after has been selected times by the gardener. .
If is selected by the gardener and not cut by the lumberjack, its height increases by 1.
If is selected by the gardener and cut by the lumberjack, its height effectively remains unchanged for that turn (it goes ).
A tree becomes majestic if its final height is at least . This means it must effectively grow in all turns when is selected. This implies must never be cut by the lumberjack in any of these turns.
Lumberjack's strategy for a single block Bj:
The lumberjack must choose a sequence of 4-tree sets L1,L from .
A tree becomes majestic if for all .
The lumberjack wants to minimize the number of such trees. This means lumberjack wants to maximize .
Let and . Both are sets of 4 trees in .
The lumberjack can adopt the following strategy for block :
- When Bj is selected for the k-th time:
- If k is odd, the lumberjack cuts trees in L.
So, for each block Bj, this strategy ensures that exactly one tree (namely T9 in this labeling) becomes majestic.
Since the lumberjack uses all 4 cuts within the currently active block B, he cannot affect other blocks.
The gardener's strategy ensures that for each of the blocks, exactly one tree becomes majestic.
The total number of majestic trees is .
Value of K:
N=2022, so M=(2022/3)2=6742.
.
So the gardener can ensure majestic trees.
Can the lumberjack prevent this?
The lumberjack's optimal strategy is to focus all cuts on the block Bj that the gardener just chose.
If the lumberjack diverts cuts to other blocks, say he cuts cj<4 trees in and trees elsewhere. Then trees in would grow in that turn.
If , then trees grow. The sum of heights in after gardener turns on would be . The lumberjack can make these heights . However, the argument should be based on the number of trees cut.
To make a tree non-majestic, it must be cut at least once.
Lumberjack has cuts for .
To minimize majestic trees in , he must make as large as possible.
If : LJ picks and . Then . This leaves untouched. So 3 trees become majestic in .
This is worse for the lumberjack than if he used 4 cuts (which resulted in 1 majestic tree).
So, the lumberjack is forced to use all 4 cuts within the block selected by the gardener. The strategy described above (alternating and ) is optimal for the lumberjack for that block, leading to 1 majestic tree in that block.
Thus, the gardener can ensure (N/3)2 majestic trees, and the lumberjack cannot reduce this number further.
The maximum value of K is (N/3).
The final answer is 454276.