#P11223. [COTS 2019] 传话游戏 Pokvareni
[COTS 2019] 传话游戏 Pokvareni
Background
Translated from Izborne Pripreme 2019 (Croatian IOI/CEOI Team Selection) D1T3。。
Problem Description
Hint: The problem setter provides a brief summary of the task at the end of the statement.
A teacher is playing a broken telephone game with children. They all know the same words, which we label as .
The game works like this:
- The children stand in a line.
- The teacher whispers word to the first child.
- For , the -th child whispers the word he heard to the -th child.
- The -th child says out loud the word he heard.
Because there were OIers nearby typing loudly on keyboards, the game was disturbed, and the children often misheard words. However, magically, for the -th child, no matter who whispers to him and no matter where he is in the line, if he is whispered the same word , he will always hear the same word (it is possible that ).
The teacher repeated the game for rounds, trying every possible permutation once. She noticed that there is a word that was said out loud exactly times. She is curious, so she asks you to recreate such a situation.
More specifically, given integers , construct positive integers , and a way that the children mishear words, such that among the rounds, is said out loud exactly times.
The smaller the you find, the higher your score. See 【Scoring】 for details.
Simply put: Given . Construct functions from to (where is a positive integer you choose), such that:
- Let range over all permutations of .
- Put into a multiset the value of $f_{p_N}(f_{p_{N-1}}\cdots(f_{p_2}(f_{p_1}(1)))\cdots)$ for each of the permutations . Then there exists some such that appears exactly times in .
Here, means .
The goal is to make as small as possible.
Input Format
This problem contains multiple testdata cases within a single test point.
The first line contains a positive integer , which indicates the subtask number.
The second line contains a positive integer , the number of testdata cases.
The next lines each contain two integers , describing one test case.
Output Format
For each test case, output lines:
The first line contains two positive integers . You must ensure .
The next lines each contain positive integers.
In the -th line, the -th positive integer means: if you whisper to the -th child, he will hear . You must ensure .
1
2
3 2
2 1
3 3
2 1 3
3 2 2
1 3 2
2 1
1 1
2 2
2
2
3 3
4 0
6 2
1 2 3 4 5 6
6 5 4 3 2 1
2 4 1 4 3 2
2 2
1 1
1 1
1 1
1 1
Hint
For of the data, it is guaranteed that:
- .
- .
- .
- .
【Scoring】
This problem is scored with two subtasks.
-
Subtask ( pts): .
As long as your construction is valid, you get full points. Otherwise, you get points.
-
Subtask ( pts): .
If your output is invalid, you get points.
Otherwise, the score for one test case is , where is computed as follows:
$$k= \begin{cases} \displaystyle 1, & M\le N+1 \\ \displaystyle 0.7 + \frac{0.15}{M-N-1}\, \in [0.7,0.85], & N+1\lt M\le N+5 \\ \displaystyle 0.5 + 0.05 \left(5-\frac{M}{N}\right) \, \in[0.5,0.7], & N+5\lt M\le 5\cdot N \\ \displaystyle \frac{0.5}{\log_{10}(M/5N)+1}\, \in [0,0.5]& 5\cdot N\lt M\le 10^4 \\ \end{cases}$$The score for a single test point is the minimum score among all testdata cases. For example, in Sample , the two test cases have values and . This output gets points.
Translated by ChatGPT 5