#P1740. Diamond A&B(1)
Diamond A&B(1)
Description
The Guru is on TV! This news is absolutely explosive. As soon as it spreads, the streets instantly become empty (everyone went home to watch TV), shops close, and factories stop. Everyone turns their TV volume to the maximum, and the Guru’s voice echoes through the streets and alleys.
Xiao L hurriedly turns on the TV at home and finds that all channels are broadcasting the Guru’s interview program (-_-bbb). On the screen, the smiling Guru presents a difficult task:
A large diamond with side length is evenly divided into an grid made of unit diamonds with side length . However, some edges in the grid have been erased. Xiao L wants to know how many parallelograms are inside the large diamond whose interiors contain no edges (i.e., the interior is empty).
This task is split into two subproblems. In this subproblem (Diamond A), given the diamond-shaped grid described by slashes and backslashes below, please convert it into an axis-aligned rectangular grid and output the presence of edges as in the specified format. The actual counting of parallelograms is handled in Diamond B.
Input Format
-
The first line contains a positive integer , the side length of the large diamond.
-
The next lines each contain characters. Each character is one of: a space, , or .
-
For the first lines (the upper half of the diamond), the -th line (1-indexed) has exactly non-space positions centered in the line. Among these positions:
- Characters at odd positions can only be or a space.
- Characters at even positions can only be or a space. A space means that the corresponding edge does not exist. All other characters outside these centered positions are spaces. These lines describe the upper half of the diamond.
-
For the last lines (the lower half of the diamond), the -th line (1-indexed within the lower half) has exactly non-space positions centered in the line, described in the same way as above, forming the lower half of the diamond.
-
It is guaranteed that no edge on the outer boundary of the large diamond is erased.
Output Format
-
The first line outputs the integer .
-
Then output lines that describe the edges after converting the diamond grid into an axis-aligned rectangular grid (think of rotating by and scaling). Use for an existing edge and for a missing edge. Specifically:
- Lines to : horizontal edges. Each of these lines contains exactly characters, each being or . The -th character on line (1-indexed) indicates whether the horizontal edge between grid points and exists.
- Lines to : vertical edges. Each of these lines contains exactly characters, each being or . Let for line index in this range. The -th character on line indicates whether the vertical edge between grid points and exists.
4
/\
/\/\
/\ /\
/ \/ \
\/\/ / /
\/\ /
\ \/
\/
4
1111
11101
1000
10111
1100
10101
0111
11101
1111
Hint
Constraints
- For of the testdata, .
- For of the testdata, .
- For of the testdata, .
- For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号