QOJ.ac

QOJ

実行時間制限: 2.0 s メモリ制限: 256 MB 満点: 100 ハック可能 ✓

#17731. 단조 증가 지각 정보학 대회

統計

MITIT(Monotonically Increasing Tardiness Informatics Tournament)의 비버 운영진은 대회가 원활하게 진행되도록 정기적으로 회의를 해야 하지만, 때때로 의욕을 잃곤 합니다.

정확히 $M$분 동안 지속되는 회의를 정기적으로 갖는 $N$마리의 비버 운영진이 있습니다. $i$번째 비버는 첫 번째 회의에 $t_i$분 늦게 도착합니다. 이후 각 회의마다 $i$번째 비버는 이전 회의보다 $a_i$분 더 늦게 도착합니다. 모든 비버가 회의 전체를 놓칠 정도로 늦게 도착하는 첫 번째 회의 번호를 출력하세요.

비버가 최소 $M$분 이상 늦게 도착하면 회의 전체를 놓친 것으로 간주합니다.

입력

첫 번째 줄에는 두 개의 정수 $N$ ($1 \le N \le 2\cdot 10^5$)과 $M$ ($1 \le M \le 10^9$)이 공백으로 구분되어 주어집니다.

다음 $N$개의 줄에는 각각 $t_i$ ($0 \le t_i < M$)와 $a_i$ ($1 \le a_i \le 10^9$)가 주어집니다.

출력

정답을 한 줄에 출력하세요.

예제

입력 1

4 60
0 9
30 4
10 12
14 9

출력 1

9

참고

첫 번째 회의에서 비버 1은 정시에 도착하고, 비버 2는 30분, 비버 3은 10분, 비버 4는 14분 늦게 도착합니다. 9번째 회의에서 비버 1은 72분, 비버 2는 62분, 비버 3은 106분, 비버 4는 86분 늦게 도착합니다. 이는 모든 비버가 최소 60분 이상 늦게 도착하는 첫 번째 회의입니다. 8번째 회의의 경우, 비버 2는 58분 늦게 도착합니다.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.