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

歡迎光臨散文網(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的評論 (共 條)

分享到微博請遵守國家法律
浙江省| 资兴市| 延安市| 华坪县| 麻阳| 横峰县| 珲春市| 德昌县| 南川市| 宝丰县| 惠东县| 怀集县| 元阳县| 武义县| 孙吴县| 平陆县| 麦盖提县| 荔波县| 江山市| 南溪县| 锦州市| 日喀则市| 达尔| 广安市| 扎赉特旗| 阿尔山市| 宿迁市| 禹州市| 襄樊市| 黎城县| 澄迈县| 临泽县| 新巴尔虎右旗| 湟源县| 保靖县| 石城县| 莱州市| 安丘市| 库尔勒市| 屏南县| 云和县|