#P11025. [COTS 2020] 辣椒 Sadnice
[COTS 2020] 辣椒 Sadnice
Background
Translated from Izborne Pripreme 2020 (Croatian IOI/CEOI Team Selection) D1T3. .
Problem Description
Peppers are planted in a garden. The garden can be described as an grid graph, where the peppers are planted on the grid points. She also uses ropes to connect adjacent grid points, so that any two pepper plants can reach each other through the ropes. In other words, the ropes form the edges of a spanning tree of this grid graph.
Define two pepper plants to be connected if and only if they are directly or indirectly connected by ropes.
At night, someone will come to sabotage. The saboteur will make one straight cut either horizontally or vertically, cutting all ropes that the cut passes through. After the cut, the pepper plants will be split into several connected components. The saboteur will try to maximize the number of connected components.
How should you arrange the ropes so that, after the cut, the number of connected components is as small as possible?
Input Format
One line with two positive integers .
Output Format
Output lines, each containing characters.
Among them, in line , the -th character represents the point (the plant in row , column ), denoted by o (ASCII 111).
For two points and in the same row, if there is an edge, fill the two spaces between them with -- (ASCII 45); otherwise, do not fill them.
For two points and in the same column, if there is an edge, fill the one space between them with | (ASCII 124); otherwise, do not fill it.
All unfilled areas should be padded with spaces. Do not output extra spaces or extra blank lines.
You may refer to the sample output.
2 2
o--o o
| |
o o--o
| |
o--o--o
2 2
o--o--o
|
o o--o
| |
o--o--o
Hint
Scoring
If your output is an optimal solution, you get full score for that test point.
Otherwise, the score multiplier is computed as follows:
$$K=0.75\times \max\left\{\left(\frac{A-1}{B-1}\right)^4,1-\left(1-\frac{1}{(B-A)^2}\right)^6\right\}$$Where is the optimal answer, and is the answer of your construction.
You will get times the score of that test point. The subtask score is the minimum score among the test points in that subtask.
For example, Sample 1 gets full score. Sample 2 gets of the score.
Constraints
For of the data, it is guaranteed that .
| Subtask ID | Special Property | Score | |
|---|---|---|---|
| A | |||
| B | |||
- Special Property A: .
- Special Property B: .
Translated by ChatGPT 5