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

31517번 - Training 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 2048 MB131787262.609%

문제

Ashley is training for a programming contest on Brandon's Online Judge. Brandon's Online Judge has a new feature which allows Ashley's coach, Tom, to load a list of problems for Ashley.

Tom has curated some problems for Ashley to work on. Each problem has two integers as a lower skill bound and an upper skill bound. Each programmer has an integer skill level. If someone with a skill level between the lower and upper bounds of a problem (inclusive), and they solve that problem, then his/her skill level goes up by 1ドル$.

Ashley will train on Tom's curated list of problems as follows -- she will look at the first problem on the list and either solve it or skip it. She will repeat this for every problem on the list in the order Tom loaded the problems. Once she has skipped a problem, she can never go back to it.

Compute the maximum skill level Ashley can have if she chooses to solve or skip problems optimally.

입력

The first line contains two integers $n$ and $s$ $(1 \le n \le 10^5, 0 \le s \le 10^9),ドル where $n$ is the number of problems Tom has curated for Ashley, and $s$ is Ashley's current skill level.

Each of the next $n$ lines contains two integers $l$ and $r$ $(0 \le l \le r \le 2 \cdot 10^9)$. These are the lower ($l$) and upper ($r$) skill bounds on each of Tom's problems, in the order that Tom loaded them.

출력

Output a single integer, which is the maximum skill level Ashley can attain.

제한

예제 입력 1

3 0
0 2
0 0
1 1

예제 출력 1

2

힌트

출처

ICPC > Regionals > North America > Pacific Northwest Regional > 2023 ICPC Pacific Northwest Region > Division 1 L번

ICPC > Regionals > North America > Pacific Northwest Regional > 2023 ICPC Pacific Northwest Region > Division 2 E번

ICPC > Regionals > North America > Mid-Central Regional > 2023 Mid-Central USA Programming Contest I번

ICPC > Regionals > North America > South Central USA Regional > 2023 South Central USA Regional Contest > Division 2 L번

ICPC > Regionals > North America > Mid-Atlantic Regional > 2023 Mid-Atlantic USA Regional Contest > Division 2 L번

ICPC > Regionals > North America > Southeast USA Regional > 2023 Southeast USA Regional Programming Contest > Division 2 L번

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

출처

대학교 대회

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

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