Editorial - WYHK 2025 Mini Contest 3
Z2531 Enumeration Again
Use two for-loops
for (int i=0;i<n;i++) for (int j=0;j<n;j++)
for even columns j % 2 == 0
,
output j * n + i + 1
for odd columns j % 2 == 1
,
output (n * (j + 1)) - i
Z2532 Print a Frame II
trivial (^◡^)
Z2533 GCDCG
Observation 1:
If the card you choose in the first round can only pass $N$ rounds, no matter how many rounds can your cards you choose later, you can only win $N$ rounds.
Observation 2:
The best card for round $i$ is a card that have the most contiguous factors starting from $i$.
Observation 3:
You can play at most around 23 rounds, as the largest possible $A_i$ is only $10^9$ and the number with the largest number of contiguous factors has only around 23 factors.
Solution:
For every round, choose the best card, and you'll win until your GCD is not enough to the next round.
Z2534 Reduction
Observation:
Decrease others' value by 1 is actually increasing the number's value by 1
Solution:
It becomes a simple problem: you can add 1 to any of the elements, how much times do we have to do this operation to make the whole array the same?
Z2535 Game of Pawns
Oberservation 1:
For the case when both pawns are next to each other, the one first moves loses as he only have one choice.
Oberservation 2:
No matter how the two players move their pawns, when both pawns are next to each other, it is always the same player moves first and loses.
Solution:
Combining the both observations, the moves of the players do not matter, we only have to calculate who is the one that will move first when the two pawns meet.
We can simply calculate the distance between them, abs(a-b)
, if it is odd, GL wins, if it is even, Hayden wins.