#K67612. Skyline Silhouette
Skyline Silhouette
Skyline Silhouette
In this problem, you are given a list of buildings where each building is represented by a triplet , with being the left x-coordinate, the right x-coordinate, and the height of the building. The goal is to compute the skyline silhouette formed by these buildings when viewed from the front. The skyline is defined as a set of key points such that the height of the silhouette changes at these x-coordinates. More formally, if you denote the silhouette as a sequence of points , then for each segment, the height of the silhouette remains constant between consecutive key points. Your task is to generate these key points in increasing order of .
inputFormat
The input is given via standard input (stdin). The first line contains an integer indicating the number of buildings. Each of the next lines contains three space-separated integers: , , and , representing the left x-coordinate, right x-coordinate, and height of a building respectively.
outputFormat
Print the key points of the skyline to standard output (stdout). Each line should contain two integers and , where is an x-coordinate where the skyline changes and is the new height at that point. The points must be printed in increasing order of .## sample
3
1 4 10
2 6 15
5 8 12
1 10
2 15
6 12
8 0
</p>