atcoder#ARC158D. [ARC158D] Equation
[ARC158D] Equation
Score : points
Problem Statement
You are given a positive integer , and a prime number at least .
Find a triple of integers that satisfies all of the following conditions.
- .
- $(x+y+z)(x^n+y^n+z^n)(x^{2n}+y^{2n}+z^{2n}) \equiv x^{3n}+y^{3n}+z^{3n}\pmod{p}$.
It can be proved that such a triple always exists.
You have test cases to solve.
Constraints
- is a prime number satisfying .
Input
The input is given from Standard Input in the following format:
Each case is in the following format:
Output
Print lines. The -th line should contain with spaces in between where is a solution for the -th test case.
If multiple solutions exist, you may print any of them.
3
1 7
2 7
10 998244353
1 4 6
1 2 5
20380119 21549656 279594297
For the first test case:
- $(x+y+z)(x^n+y^n+z^n)(x^{2n}+y^{2n}+z^{2n}) = (1+4+6)(1+4+6)(1+16+36) = 6413$, and
- .
We have , so the conditions are satisfied.