#P6265. [COCI 2014/2015 #3] SILUETA
[COCI 2014/2015 #3] SILUETA
Description
From your point of view, Vincent’s skyscrapers are rectangles whose sides are parallel to the coordinate axes, with one side lying on the -axis. In the picture, the -axis should be drawn using the character *, the outline of the skyscrapers using #, and everything else using .. The left edge of the picture must start with a skyscraper, and the right edge of the picture must end with a skyscraper. Also, to verify the result obtained by mathematicians, output the perimeter of the given outline, instead of counting the side that lies on the -axis.
Input Format
The first line contains an integer , the number of skyscrapers.
Each of the next lines contains three integers and , describing the position of the -th skyscraper. In the Cartesian coordinate system, the skyscraper is treated as a rectangle with the bottom-left corner at and the top-right corner at .
Output Format
Output an integer on the first line, the perimeter of the skyscraper outline.
In the next lines, where is the height of the tallest skyscraper, output Vincent’s drawing as described above.
3
1 5 4
7 11 3
9 13 5
28
........####
####....#..#
#..#..###..#
#..#..#....#
#..#..#....#
************
6
2 8 7
5 13 5
2 18 3
23 26 5
20 31 7
21 30 10
61
...................#########.
...................#.......#.
...................#.......#.
######............##.......##
#....#............#.........#
#....######.......#.........#
#.........#.......#.........#
#.........######..#.........#
#..............#..#.........#
#..............#..#.........#
*****************************
Hint
Explanation of Sample Input/Output 1
In the figure below, blue shows the skyscraper outline (character #), and yellow is the part of the -axis in Vincent’s painting (character *).

Constraints
- For of the testdata, , and .
- For of the testdata, , , and .
Translated by ChatGPT 5
京公网安备 11011102002149号