#P9142. [THUPC 2023 初赛] 欺诈游戏
[THUPC 2023 初赛] 欺诈游戏
Background
In LIAR GAME, Little E saw an interesting game.
Problem Description
This game is called Smuggling Game. The rules are roughly as follows: one player plays the smuggler, and the other player plays the inspector. The smuggler can secretly put yen into a box ( is an integer in , chosen by the smuggler), and the inspector needs to guess the amount in the box. Suppose the inspector guesses (and must also be an integer). If , the smuggling fails, and the smuggler gets nothing. If , the smuggling succeeds, and the smuggler can take yen from the inspector. If , the smuggling fails, but because the inspector wrongly accused the smuggler, the inspector must pay the smuggler yen. The game is played in a finite number of rounds. The two players take turns being the smuggler and the inspector.
It can be proven that, under optimal play, in each round the smuggler will use the same strategy, and the inspector will also use the same strategy. Little E wants to know, in a single round, what the optimal strategies of both sides are.
Input Format
One line with a positive integer .
Output Format
Output two lines, each containing numbers. The -th number represents the probability of placing/guessing yen.
Output the smuggler's strategy on the first line, and the inspector's strategy on the second line.
You need to guarantee that, when one side's strategy remains unchanged, the other side cannot increase their expected payoff by changing their strategy in any way.
It can be proven that such strategies are unique.
Output the answer modulo .
1
665496236 332748118
332748118 665496236
Hint
Sample Explanation 1
These numbers are .
Subtasks
Constraints: .
Source
From the preliminary round of the 2023 Tsinghua University Student Programming Contest and Collegiate Invitational (THUPC2023).
Resources such as the editorial can be found at https://github.com/THUSAAC/THUPC2023-Pre.
Translated by ChatGPT 5