#P13607. [NWRRC 2022] Joking?
[NWRRC 2022] Joking?
题目描述
Julia wants to create a new board game for players. As part of the game, players decide the order of their turns. The game should be fair: every possible permutation of players should be chosen with the same probability.
To help players determine this permutation, Julia wants to create different -sided dice. Each player will throw their own dice and look at the number. The player with the smallest number will go first, the player with the second smallest number will go second, and so on. To make sure no ties could happen, all numbers used on all dice should be distinct.
That could be a good math problem, but this is a programming contest, so we allow some imprecision. We ask you to create the dice for this game, but the probabilities of obtaining the permutations may differ slightly. Your solution will be accepted if the relative difference of probabilities of any two permutations is no more than 0.2%.
Formally, there are different outcomes of throwing all dice. For each permutation , we can compute the number of scenarios that lead to this permutation. For any two permutations and , the following should be true: .
You may choose any , but it may not exceed .
输入格式
The only line contains a single integer ~--- the number of players ().
输出格式
In the first line, print a single integer ~--- the number of sides on each dice ().
Each of the next lines should describe one dice. For each dice, print integers from to . All integers used on all dice should be distinct.
2
2
1 4
2 3
3
16
3 7 9 10 12 17 18 19 28 32 33 35 38 40 43 48
1 2 6 13 14 20 22 26 27 29 30 36 37 39 44 46
4 5 8 11 15 16 21 23 24 25 31 34 41 42 45 47
提示
In the first example test, both permutations of players have the probability of .
In the second example test, there are possible scenarios. Permutations and arise in scenarios each, while every other permutation arises in scenarios. Thus, the relative difference between the most and the least probable permutations is .