solutions: 230A
This commit is contained in:
parent
8de993c32d
commit
b05eee28b1
1 changed files with 18 additions and 0 deletions
18
solutions/230A.py
Normal file
18
solutions/230A.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
import sys
|
||||
|
||||
s, n = [int(d) for d in input().split(' ')]
|
||||
|
||||
dragons = []
|
||||
|
||||
for _ in range(n):
|
||||
dragons.append([int(d) for d in input().split(' ')])
|
||||
|
||||
dragons = sorted(dragons, key=lambda x: x[0])
|
||||
|
||||
for i in dragons:
|
||||
if s > i[0]:
|
||||
s += i[1]
|
||||
else:
|
||||
print("NO")
|
||||
sys.exit()
|
||||
print("YES")
|
Loading…
Reference in a new issue