問題一覧 > 通常問題

No.3039 配信者

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 150
作問者 : eiram / テスター : nauclhlt Blue_S naniwazu
お気に入りにしたユーザー ProblemId : 11834 / 自分の提出
問題文最終更新日: 2025-02-09 01:36:57
Streamers
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Show the original
yukicoder contest 458 (順位表) の他の問題:

Story

eiram often watches live streams. With many favorite streamers, their streaming times overlap with those of other streamers he wants to watch, which makes him sad...
But in such cases, the problem is solved by watching multiple streamers at the same time.

Problem Statement

eiram has $N$ favorite streamers. $1$ day consists of $H$ hours.
The stream of person $i(1 \le i \le N)$ starts at $A_i$ o'clock and ends at $B_i$:$59$.
If different streamers are streaming at the same time, eiram watches all of their streams.
eiram wondered how many streams, at most, he has to watch at the same time.

Your task is to write a program that, on eiram's behalf, finds the maximum number of people whose streams he has to watch at the same time.


Constraints

$・1 \le N \le 10^6 $
$・1 \le H \le 10^6 $
$・0 \le A_i \leq B_i < H$

Input

The input is given from standard input in the following format.
$N$ $H$
$A_1$ $B_1$
$A_2$ $B_2$
・
・
・
$A_N$ $B_N$

Output

Output the maximum number of people whose streams he has to watch at the same time.
Print a newline at the end.

Sample

Sample 1
Input
3 5
0 2
1 4
2 3
Output
3

1 day consists of the $5$ hours from $0$ o'clock to $5$ o'clock.
・Person $1$ streams from $0$ o'clock to $2$:$59$.
・Person $2$ streams from $1$ o'clock to $4$:$59$.
・Person $3$ streams from $2$ o'clock to $3$:$59$.
At $0$ o'clock, person $1$ is streaming;
at $1$ o'clock, persons $1,2$ are streaming;
at $2$ o'clock, persons $1,2,3$ are streaming;
at $3$ o'clock, persons $2,3$ are streaming;
at $4$ o'clock, person $2$ is streaming.
At $2$ o'clock, he has to watch the streams of the $3$ persons $1,2,3$ at the same time. Therefore, output 3.

Sample 2
Input
7 10
8 9
3 6
2 4
1 8
7 9
0 4
5 6
Output
4

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。