MathDB

2023 Japan TST

Part of Japan TST

Subcontests

(5)
8
1

Long Long Long Game Again

A and B are playing a game on a blackboard. At the beginning, a positive real number xx is fixed. First, A chooses a prime number pp greater than or equal to 77. Then, B selects non-negative real numbers r1r_1 and r2r_2. A then chooses two integers ss and tt such that r1<s<r1+xpr_1<s<r_1+xp and r2<t<r2+xpr_2<t<r_2+xp, and writes on the blackboard the remainders of 00, ss, tt, and stst when divided by pp in this order.
After that, A can repeatedly choose one of the following three operations as many times as they like:
[*] Choose an integer mm between 11 and p1p-1 inclusive, and replace each of the four numbers on the blackboard with the remainder of adding mm and then dividing by pp. [*] Choose an integer nn between 22 and p1p-1 inclusive, and replace each of the four numbers on the blackboard with the remainder of multiplying by nn and then dividing by pp. [*] Replace each of the four numbers on the blackboard with its remainder when squared and then divided by pp, but this operation is not allowed if at least one of the four numbers is 00.
A's objective is to make the numbers on the blackboard become 00, 22, 33, and 66 in that order. However, if there are no integers ss and tt that satisfy r1<s<r1+xpr_1<s<r_1+xp and r2<t<r2+xpr_2<t<r_2+xp, then A cannot achieve the objective.
Find the maximum possible value of xx such that regardless of A's actions, B can always prevent A from achieving the objective.