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

20638번 - Universal and Existential Quantifiers 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB47201540.541%

문제

You are given a list of $N$ intervals. The $i$-th interval is $[l_i,r_i),ドル which denotes a range of numbers greater than or equal to $l_i$ and strictly less than $r_i$. In this task, you consider the following two numbers:

  • The minimum integer $x$ such that you can select $x$ intervals from the given $N$ intervals so that the union of the selected intervals is $[0,L)$.
  • The minimum integer $y$ such that for all possible combinations of $y$ intervals from the given $N$ interval, it does cover $[0,L)$.

We ask you to write a program to compute these two numbers.

입력

The input consists of a single test case formatted as follows.

The first line contains two integers $N$ (1ドル \le N \le 2 \cdot 10^5$) and $L$ (1ドル \le L \le 10^{12}$), where $N$ is the number of intervals and $L$ is the length of range to be covered, respectively. The $i$-th of the following $N$ lines contains two integers $l_i$ and $r_i$ (0ドル \le l_i < r_ i \le L$), representing the range of the $i$-th interval $[l_i,r_i)$. You can assume that the union of all the $N$ intervals is $[0,L)$.

출력

Output two integers $x$ and $y$ mentioned in the problem statement, separated by a single space, in a line.

제한

예제 입력 1

3 3
0 2
1 3
1 2

예제 출력 1

2 3

예제 입력 2

2 4
0 4
0 4

예제 출력 2

1 1

예제 입력 3

5 4
0 2
2 4
0 3
1 3
3 4

예제 출력 3

2 4

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2020 > Day 5: JAG Summer+ Opening Contest M번

Contest > ICPC Japanese Alumni Group > JAG Summer Camp > JAG Summer Camp 2019 Day 1 C번

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

출처

대학교 대회

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

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