#P10874. [COTS 2022] 旅程 Dugput(非官方数据)
[COTS 2022] 旅程 Dugput(非官方数据)
Background
Translated from Izborne Pripreme 2022 (Croatian IOI/CEOI Team Selection) D2T1。。
- The input format is slightly adjusted.
- The official testdata is incorrect. Some out files were generated using the code of “Tree Sister” hhoppitree. If you get a score , feel free to contact the problem porter to update the testdata.
Problem Description
Construct an grid graph where all edge weights are , and each edge may exist or not exist.
Under the condition that the graph is connected, maximize the shortest path length from to .
Here, the path length is defined as the number of nodes visited by the path.
Input Format
This problem contains multiple test cases within a single test point.
The first line contains two integers , representing the testdata type and the number of test cases.
The next lines each contain integers , with meanings as described in the statement.
Output Format
For each test case, output several lines.
- : “Construction” type testdata.
For this type, you need to construct a grid graph. Output lines, each with characters.
In line , the character at position represents the vertex . When or , print * (ASCII 42); otherwise print o (ASCII 111).
For two vertices and in the same row, if there is an edge, fill the two spaces between them with -- (ASCII 45); otherwise, leave them unfilled.
For two vertices and in the same column, if there is an edge, fill the one space between them with | (ASCII 124); otherwise, leave it unfilled.
All unfilled areas should be padded with spaces. Do not output extra spaces or blank lines.
See the sample output.
- : “Traditional” type testdata.
You only need to output one line with one integer, representing the shortest possible value of the maximum shortest path length.
0 2
2 3 1 1 2 2
3 3 1 1 3 3
*--o--o
|
o *--o
* o--o
| | |
o o o
| | |
o--o *
0 2
2 3 1 1 2 2
3 3 1 1 3 3
*--o o
|
o * o
* o o
|
o o--o
| | |
o--o *
1 2
2 3 1 1 2 2
3 3 1 1 3 3
5
9
Hint
For of the testdata, it is guaranteed that:
- ;
- ;
- ,;
- 。
| Subtask ID | Score | |||
|---|---|---|---|---|
[Scoring]
- : “Construction” type testdata.
Let be the shortest path length in the construction you output for the -th test case, and let be the maximum possible shortest path length. Define
When , you get full score for this test point; otherwise, you get times the score of this test point.
The score of each subtask is the over the scores of all test points.
For example, the output of Sample 1 gets full score; for Sample 2, $\displaystyle k=\frac{1}{2}\left(\frac{3}{5}+\frac{5}{9}\right)=\frac{31}{45}$, so you will get times the score of this test point.
- : “Traditional” type testdata.
Same as the standard scoring method for traditional problems.
Translated by ChatGPT 5