#P10874. [COTS 2022] 旅程 Dugput(非官方数据)

    ID: 12345 远端评测题 5000ms 500MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>2022Special JudgeO2优化构造COCI(克罗地亚)

[COTS 2022] 旅程 Dugput(非官方数据)

Background

Translated from Izborne Pripreme 2022 (Croatian IOI/CEOI Team Selection) D2T1。5s,0.5G\texttt{5s,0.5G}

  • 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 >100\gt 100, feel free to contact the problem porter to update the testdata.

Problem Description

Construct an N×MN \times M grid graph where all edge weights are 11, and each edge may exist or not exist.

Under the condition that the graph is connected, maximize the shortest path length from (A,B)(A,B) to (C,D)(C,D).

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 type,T\mathrm{type},T, representing the testdata type and the number of test cases.

The next TT lines each contain 66 integers N,M,A,B,C,DN,M,A,B,C,D, with meanings as described in the statement.

Output Format

For each test case, output several lines.

  • type=0\mathrm{type}=0: “Construction” type testdata.

For this type, you need to construct a grid graph. Output (2N1)(2N-1) lines, each with (3M2)(3M-2) characters.

In line (2i1)(2i-1), the character at position (3j2)(3j-2) represents the vertex (i,j)(i,j). When (i,j)=(A,B)(i,j)=(A,B) or (S,T)(S,T), print * (ASCII 42); otherwise print o (ASCII 111).

For two vertices (i,j)(i,j) and (i,j+1)(i,j+1) 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 (i,j)(i,j) and (i+1,j)(i+1,j) 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.

  • type=1\mathrm{type}=1: “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 100%100\% of the testdata, it is guaranteed that:

  • 1N,M50001\le N,M\le 5\, 000
  • 1T16001\le T\le 1\, 600
  • 1A,CN1\le A,C\le N1B,DM1\le B,D\le M
  • (A,B)(C,D)(A,B)\neq (C,D)
Subtask ID NMN\cdot M\in MM\le type=\mathrm{type}= Score
11 [2,100][2,100] 50005\, 000 00 2020
22 [2,1000][2,1\, 000] 2525
33 [2,15000][2,15\, 000] 33 1515
44 [2,100000][2,100\, 000] 50005\, 000 2525
55 11 1515

[Scoring]

  • type=0\mathrm{type}=0: “Construction” type testdata.

Let did_i be the shortest path length in the construction you output for the ii-th test case, and let DiD_i be the maximum possible shortest path length. Define

K=1Qi=1QdiDiK=\frac{1}{Q}\sum_{i=1}^Q\frac{d_i}{D_i}

When K=1K=1, you get full score for this test point; otherwise, you get 0.7K0.7\cdot K times the score of this test point.

The score of each subtask is the min\min 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 0.731450.482\displaystyle 0.7\cdot \frac{31}{45}\approx 0.482 times the score of this test point.

  • type=1\mathrm{type}=1: “Traditional” type testdata.

Same as the standard scoring method for traditional problems.

Translated by ChatGPT 5