最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊

CF 230A - Dragons

2023-07-21 16:28 作者:您是打尖兒還是住店呢  | 我要投稿

Kirito is stuck on a level of the MMORPG he is playing now. To move on in the game, he's got to defeat all n dragons that live on this level. Kirito and the dragons have strength, which is represented by an integer. In the duel between two opponents the duel's outcome is determined by their strength. Initially, Kirito's strength equals s.


If Kirito starts duelling with the i-th (1?≤?i?≤?n) dragon and Kirito's strength is not greater than the dragon's strength xi, then Kirito loses the duel and dies. But if Kirito's strength is greater than the dragon's strength, then he defeats the dragon and gets a bonus strength increase by yi.


Kirito can fight the dragons in any order. Determine whether he can move on to the next level of the game, that is, defeat all dragons without a single loss.


Input

The first line contains two space-separated integers s and n (1?≤?s?≤?104, 1?≤?n?≤?103). Then n lines follow: the i-th line contains space-separated integers xi and yi (1?≤?xi?≤?104, 0?≤?yi?≤?104) — the i-th dragon's strength and the bonus for defeating it.


Output

On a single line print "YES" (without the quotes), if Kirito can move on to the next level and print "NO" (without the quotes), if he can't.

-----------------------------------

桐人陷入了他現(xiàn)在正在玩的 MMORPG 的某個(gè)關(guān)卡。 為了在游戲中繼續(xù)前進(jìn),他必須擊敗生活在這一層的所有 n 條龍。 桐人與龍族的實(shí)力,是用整數(shù)來表示的。 在兩個(gè)對手之間的對決中,決斗的勝負(fù)取決于他們的實(shí)力。 最初,桐人的力量為s。


如果桐人開始與第 i (1?≤?i?≤?n) 條龍決斗,并且桐人的力量不大于龍的力量 xi,則桐人在決斗中失敗并死亡。 但如果桐人的力量大于龍的力量,那么他就會(huì)擊敗龍并獲得毅力的額外力量提升。


桐人可以以任何順序與龍戰(zhàn)斗。 確定他是否可以進(jìn)入游戲的下一個(gè)關(guān)卡,即以一敗涂地的方式擊敗所有龍。


輸入

第一行包含兩個(gè)空格分隔的整數(shù) s 和 n (1?≤?s?≤?104, 1?≤?n?≤?103)。 然后是 n 行:第 i 行包含空格分隔的整數(shù) xi 和 yi (1?≤?xi?≤?104, 0?≤?yi?≤?104) — 第 i 條龍的力量和擊敗它的獎(jiǎng)勵(lì)。


輸出

如果 Kirito 可以進(jìn)入下一個(gè)級別,則在單行中打印“YES”(不帶引號);如果不能,則打印“NO”(不帶引號)。

--------------------------------

打怪的快樂跟AC的快樂,哪個(gè)更快樂,雙倍快樂最好了。。


CF 230A - Dragons的評論 (共 條)

分享到微博請遵守國家法律
神木县| 桦甸市| 镇坪县| 阳城县| 图们市| 兰州市| 长寿区| 自贡市| 乐山市| 成都市| 华阴市| 弥渡县| 松潘县| 兴宁市| 秭归县| 洛宁县| 三明市| 柳河县| 卓尼县| 永嘉县| 北京市| 水富县| 确山县| 乌拉特后旗| 兴安县| 巫溪县| 青河县| 开江县| 湖州市| 延边| 雷州市| 泰兴市| 屯留县| 万山特区| 渑池县| 鸡泽县| 南宁市| 本溪市| 翁源县| 乌鲁木齐市| 思茅市|