407020: GYM102688 B Ding Ding's Art/Science Exhibit

Memory Limit:1024 MB Time Limit:15 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Ding Ding's Art/Science Exhibittime limit per test15 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard output

Society would have you believe that being good at the sciences and being good at the arts are mutually exclusive. The "left-brained" and "right-brained" myth is still spread in many schools throughout the world. They would have you think that each person is either good at science and bad at art or good at art and bad at science. This is not true! In reality, a majority of the people in this world are bad at science and bad at art. But that's okay! The real takeaway is that whether or not you are objectively good at something, there is inherent value to pursuing what you are passionate in. Ding Ding is one such person who is neither good at science nor art. Still, he wants to combine both together to create a super cool science-art project!

Ding Ding has three transparent sheets of acrylic, each of which can be divided into a grid with $$$r$$$ rows and $$$c$$$ columns. All types of light pass through this material with no effect. Ding Ding plans to paint some of the cells in each sheet with a special kind of paint that acts as a light filter. When normal light passes through a painted cell, it becomes polarized; when polarized light passes through a painted cell, it becomes normal light again. For his art project, Ding Ding will layer the three sheets of acrylic, one on top of another. Ding Ding shines parallel rays of light at the sheets, and each ray of light passes through the corresponding overlaid cells in the first, then second, then third sheet, before exiting. Ding Ding plans to paint the cells in such a way that if all light that enters the sheets is normal, then all light that exits should be normal as well.

Ding Ding understands that there are many ways to paint the three sheets such that this condition holds. He devises the following formula for computing the beauty of a given project.

Ding Ding measures the beauty of the project in terms of the maximum number of regions that each sheet can be partitioned into. A region is simply a nonempty set of unpainted cells. A partition of a given sheet into regions is considered valid if (and only if) all of the following are satisfied:

  • Every unpainted cell belongs to exactly one region.
  • If two unpainted cells share an edge, then they belong to the same region.

The size of a partition is simply the number of regions in it.

Let $$$x_1$$$ be the maximum size of any valid partition of the first sheet into regions; define $$$x_2$$$ and $$$x_3$$$ similarly for the second and third sheets, respectively.

Ding Ding now defines the beauty of a given project as $$$\max(0, \min(2, S))$$$, where $$$S$$$ is computed using the following formula: $$$$$$S = \frac{8\min(x_1, x_2, x_3) - 2\max(x_1, x_2, x_3)}{rc - 3}$$$$$$

Ding Ding has already finished this project $$$50$$$ different times with different values of $$$r$$$ and $$$c$$$ for his exhibit. Now, it's your turn—Ding Ding challenges you to make an exhibit with the same $$$50$$$ values of $$$r$$$ and $$$c$$$ and to make it as beautiful as possible.

Input

The first line of input contains a single integer $$$t$$$. The following $$$t$$$ lines describe the test cases.

Each test case consists of a single line containing two space-separated integers $$$r$$$ and $$$c$$$.

Output

For each test case, output $$$3r+3$$$ lines.

Each of the first $$$r$$$ lines must contain exactly $$$c$$$ characters representing a row of the first sheet. The $$$j$$$th character of the $$$i$$$th row represents the state of the cell at the $$$i$$$th row and $$$j$$$th column and must be either:

  • '#' for painted, or
  • '.' for unpainted.

After the said $$$r$$$ lines, output a single line containing a single dash character, -.

The next $$$r+1$$$ lines must describe the second sheet and must be in the same format as the first sheet. Then the $$$r+1$$$ lines after that must describe the third sheet and must be in the same format as the first sheet.

Scoring

$$$t = 50$$$.

The test cases are all distinct.

For each pair $$$(r, c)$$$, exactly one of the following is true:

  • $$$r \in \{36, 37, 38, 39, 40 \}$$$ and $$$c \in \{38, 39, 40, 41, 42\}$$$, or
  • $$$r$$$ and $$$c$$$ are both in $$$\{11, 99, 500, 750, 1000\}$$$.

Your score will be the sum of the beauties of your outputs across all cases. Since the maximum beauty is $$$2$$$, the maximum possible score is $$$100$$$ points.

If your output is invalid for a case, then it is considered to be an output with $$$0$$$ beauty. If your output cannot be interpreted properly as a list of answers for $$$t$$$ test cases, then your score will be $$$0$$$ overall.

Note that your score is rounded down to the nearest integer, so in particular, you can only get a score of $$$100$$$ if you obtain a beauty of $$$2$$$ for all $$$50$$$ cases.

ExampleInput
1
5 6
Output
..#...
..#...
###...
......
......
-
......
......
...###
...#..
...#..
-
..#...
..#...
######
...#..
...#..
-
Note

Note: This sample I/O doesn't follow the constraints and so will not appear in the input.

Note that:

  • The first sheet has size $$$x_1 = 2$$$.
  • The second sheet has size $$$x_2 = 2$$$.
  • The third sheet has size $$$x_3 = 4$$$.

Therefore, $$$$$$S = \frac{8\cdot 2 - 2\cdot 4}{5\cdot 6 - 3} = 0.296296\ldots$$$$$$

so the beauty is $$$\max(0, \min(S, 2)) = 0.296296\ldots$$$ Note that a line containing a single dash (-) must be printed after each sheet, including the last one.

加入题单

上一题 下一题 算法标签: