Logo
(追記) (追記ここまで)

32680번 - Sauna 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1.5 초 (추가 시간 없음) 1024 MB140947564.103%

문제

Kaisa and her friends are going to the sauna!

Now they have to pick the temperature. Each of them has their own temperature preferences as an inclusive range of acceptable values. Can you help them find the temperatures that everyone is happy with?

Since there might be a large number of possible temperatures, they have asked you to just tell them how many options there are and what the lowest temperature that works for everyone is, as then the sauna will need less time to heat up.

입력

The first line of input contains an integer, $N,ドル the number of people in the group (2ドル \le N \le 2 \cdot 10^5$). The next $N$ lines each contains two integers, $a_i$ and $b_i,ドル indicating that the $i$th person's temperature preference is between $a_i$ and $b_i,ドル inclusive. Temperatures are given in millidegrees Celsius, with 0ドル \le a_i \le b_i \le 2 \cdot 10^5$.

출력

Output two integers: first, the number of different temperatures (in millidegrees Celsius) that fit all preferences; and second, the lowest such value.

If there are no values that fit all preferences, instead output "bad news".

제한

예제 입력 1

3
70000 70005
70003 70010
65000 80000

예제 출력 1

3 70003

There are three possible temperatures that all three people will be happy with: 70003, 70004, 70005.

예제 입력 2

2
70000 70500
80000 80100

예제 출력 2

bad news

힌트

출처

ICPC > Regionals > North America > North Central North America Regional > 2024 North Central NA Regional Contest K번

ICPC > Regionals > North America > Rocky Mountain Regional > 2024 Rocky Mountain Regional Contest L번

ICPC > Regionals > North America > Mid-Central Regional > 2024 Mid-Central USA Programming Contest L번

  • 문제를 만든 사람: Lawry Sorenson
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /