問題一覧 > 通常問題

No.1205 Eye Drops

レベル : / AI推定難易度 : 214 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 275
作問者 : kaage / テスター : penguinman
お気に入りにしたユーザー ProblemId : 4850 / 自分の提出
問題文最終更新日: 2020-08-30 13:03:06
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. Back to the original
技術室奥プログラミングコンテスト#5 Day2 (順位表) の他の問題:

Problem Statement

There are $N$ consecutive sections, numbered from $0$ to $N-1$. Kaage is currently in section $0$, and the time is $0$.
Kaage can move to an adjacent section in $1$ unit of time. That is, if he is in section $i$ at time $t$, then at time $t+1$ he can stay at $i$ or move to $i-1,i+1$ (if they exist).
You are now given $M$ pieces of information of the form "at time $T_i$, eye drops fall from the second floor onto section $P_i$".
By moving appropriately, can Kaage catch all the eye drops at the times they fall?
Here, Kaage can also catch the eye drops falling at the moment he has just arrived at a section.

Input

$N\ M$
$T_1\ P_1$
$T_2\ P_2$
$\vdots$
$T_M\ P_M$
  • $1\leq N,M\leq 10^5$
  • $0\leq P_i\leq N-1$
  • $0\leq T_i\leq 10^{10}$
  • $T_i\leq T_{i+1}(0\leq i< M-1)$
  • All input values are integers.

Output

Print "Yes" if Kaage can catch all the eye drops, and "No" otherwise, on one line.

Sample

Sample 1
Input
3 2
1 0
4 2
Output
Yes
Sample 2
Input
2 1
0 1
Output
No

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