Silueta
의견: 0
\(3^{rd}\) round, November \(29^{th}\), 2014
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.
In test cases worth 50% of total points, it will hold (1 ⩽N ⩽100) (1 ⩽L_{i}, R_{i}, H_{i} ⩽100).
If the programme outputs the correct perimeter, but the wrong image, it will get 40% of points for that test case.
If the programme outputs the wrong perimeter, but the correct image, it will get 60% of points for that test case.
If you can draw the image, but cannot calculate the perimeter, output a single integer in the first line and then
output the image.
\(3^{rd}\) round, November \(29^{th}\), 2014
The first line of input contains an integer N (1 ⩽N ⩽10 000), the number of skyscrapers.
Each of the following N lines contains three integers L_{i}, R_{i} and H_{i} (1 ⩽L_{i}, R_{i}, H_{i} ⩽1, 000, 3 ⩽\(R_{i} - L_{i}\) ⩽1, 000)
that describe the position of the i^{th} skyscraper. That skyscraper, in a Cartesian coordinate system, is considered
a rectangle with its lower left corner in (L_{i}, 0) and upper right corner in (R_{i}, H_{i}).
The first line of output must contain the perimeter of Vincent’s silhouette.
The next \(h+1\) lines, where \(h+1\) is the height of the highest skyscraper, must contain Vincent’s drawing as described
in the task.
3
1 5 4
7 11 3
9 13 5
6
2 8 7
5 13 5
2 18 3
23 26 5
20 31 7
21 30 10output
28
........####
####....#..#
#..#..###..#
#..#..#....#
#..#..#....#
************
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 ‘*’).
평가 및 의견
Silueta
Log in to rate problems.
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Silueta