프로그램 명: coci_silueta
제한시간: 0.2 초

화가 빈센트는 세계를 여행하면서 다양한 풍경을 보아왔다. 그 풍경들 중에서 빈센트가 가장 감명 깊었던 것은 빌딩들이 빼곡한 도시의 풍경이었다. 빈센트는 그 때 보았던 풍경을 그렸으나, 불의의 사고로 유실되었다. 빈센트는 자신의 그림을 복원하기 위해 프로그래머를 고용했다.

빈센트가 그림을 그렸던 곳은 총 N개의 건물들이 있었고, 그 건물들은 모두 2개의 변이 지면과 평행한 직사각형 모양이었다고 한다. 빈센트는 도시의 풍경을 그릴 때 격자 형태의 도화지에 그림을 그렸으며, 지면을 '*'로, 건물의 경계선은 '#'로, 나머지 빈 공간은 '.'으로 그렸다고 한다.

빈센트가 봤던 건물들의 정보가 주어질 때, 빈센트의 그림을 복원하는 프로그램을 작성하여라.

입력 형식

출력 형식

입출력 예

입력

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
...................#########.
...................#.......#.
...................#.......#.
######............##.......##
#....#............#.........#
#....######.......#.........#
#.........#.......#.........#
#.........######..#.........#
#..............#..#.........#
#..............#..#.........#
*****************************

The main hero of this task, painter Vincent, spent a great deal of his youth travelling the world. Sights from numerous voyages have often been the inspiration for his, nowadays highly praised, works of art. On one occasion, Vincent found himself in a metropolis full of skyscrapers so he got down to work right away, intoxicated by the marvelous sight. For a number of reasons, incomprehensible to an average programmer, Vincent decided to paint only the silhouettes of the skyscrapers seen before him. Unfortunately, a week after he finished this masterpiece, the painting spontaneously caught fire.

In order to reconstruct the painting, Vincent sought help in all directions; architects provided him with the exact dimensions of the skyscrapers, physicists ignored air resistance, mathematicians mapped everything onto a plane and now it’s your turn!

From your perspective, Vincent’s skyscrapers are rectangles whose sides are parallel to coordinate axes and with one side that lies on the abscissa. Part of the abscissa on the image should be shown with the characters ‘*’, the silhouettes of the skyscrapers with ‘#’ and fill the rest of the image with ‘.’. The left edge of the image must begin with a skyscraper, whereas the right edge of the image must end with a skyscraper. Additionally, in order to verify the results the mathematicians got, output the perimeter of the given silhouette not calculating the sides that lie on the abscissa.

입력

출력

입출력 예

입력

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
...................#########.
...................#.......#.
...................#.......#.
######............##.......##
#....#............#.........#
#....######.......#.........#
#.........#.......#.........#
#.........######..#.........#
#..............#..#.........#
#..............#..#.........#
*****************************

Clarification of the first example: Blue color denotes the skyscrapers’ silhouette (character ‘#’), whereas yellow is the
part of abscissa located on Vincent’s painting (character ‘*’).
출처:coci 2013/2014 3/6
번역:functionx

[질/답] [제출 현황] [푼 후(0)]
[ 채 점 ] [홈으로]  [뒤 로]