Don't Be Fake
시간 제한1초메모리 제한1024 MB
N명의 친구마다 겹치지 않는 가용 시간 구간이 주어질 때, 가장 많은 친구가 가용한 초와 그 최댓값을 내는 초의 개수를 구한다.
문제
DontBeFake is an app where people get a notification at a random point in time, and they have to take a picture of what they are doing right now.
You have friends on DontBeFake. Each friend has a set of intervals of seconds when they are available. If they get a notification at second and they are available, they will take a picture and you will get to see it. Because the DontBeFake app is slow and so is taking a picture, even if they are available a second later, they will not have time to take the picture. All friends live in the same time zone and will get one notification at exactly the same time in the day. All times are specified as seconds from midnight.
You want to know what is the maximum number of pictures you can view in the day, over all possible seconds that the notification can arrive. In addition, you also want to know how many different seconds the notification could arrive for the maximum number of pictures to be taken.
입력
Input begins with a line containing the integer (). The next lines each describes the set of available intervals for the friends. Each such line starts with an integer () followed by pairs of integers , () meaning that the friend is available between and seconds, inclusive. It is guaranteed that for all , so that the intervals do not overlap. It is also guaranteed that .
출력
Output on the first line the maximum number of pictures you can view in the day. On the second line, output the total number of seconds the notification could arrive for the maximum number of pictures to be taken.