P15269 「UTOI 1D」Flowerfell
Description
A sequence $a$ is called **beautiful** if and only if there exists **exactly** one quadruple $(i,x,j,y)$ such that $a_i=a_j$, $a_x=a_y$, and $a_i \neq a_x$, satisfying $i
Input Format
The first line contains an integer $D$, representing the subtask ID.
The second line contains an integer $T$, representing the number of test cases.
For each test case:
- One line with an integer $k$.
Output Format
Output $T$ lines. For each test case:
- Output one line containing a positive integer $n$, and on the next line output the constructed sequence $b$.
If there are multiple construction methods, you may output any one. All sequences $b$ that satisfy the requirements will be considered correct.
Explanation/Hint
**【Constraints】**
**This problem uses Special Judge and bundled tests.**
| $D=$ | $k\le$ | $\sum k\le$ | Special Property | Scoring Method | Points |
| :--: | :----: | :---------: | :--------------: | :------------: | :----: |
| $1$ | $12$ | $78$ | None | $\text{A}$ | $10$ |
| $2$ | $100$ | $2550$ | $k$ is even | $\text{B}$ | $10$ |
| $3$ | $100$ | $5050$ | None | $\text{B}$ | $30$ |
| $4$ | $1000$ | $10^4$ | None | $\text{B}$ | $10$ |
| $5$ | $10^5$ | $10^6$ | $k\ge 100$ | $\text{B}$ | $20$ |
| $6$ | $10^5$ | $10^6$ | None | $\text{A}$ | $20$ |
Scoring Method $\text{A}$:
You will receive full points for this test point if and only if for every $k$ in this test point, you can construct a sequence $b$ of length $n$ that meets the requirements and $n$ is minimum.
Scoring Method $\text{B}$:
For a given $k$, let $a=\lceil \sqrt{10k}\rceil+1$, $b$ be the minimum $n$ that can be constructed, $c$ be the point value of this test point, and $x$ be the length of the sequence you constructed. Your score for this $k$ is $\lfloor \dfrac{3(a-x)c}{(a-b)(x-b+3)}\rfloor$. The final score for the test point is the minimum of these values over all $k$.
For $100\%$ of the test points, it is guaranteed that $1\le T\le 10^5$, $1\le k\le 10^5$, and $1\le \sum k\le 10^6$.