(G) Драконы

public
yeskendir.sultanov Apr 26, 2024 Never 108
Clone
Python G.py 18 lines (14 loc) | 280 Bytes
1
s, n = map(int, input().split())
2
d = []
3
for i in range(n):
4
x, y = map(int, input().split())
5
d.append((x, y))
6
7
d = sorted(d)
8
9
result = 'YES'
10
11
for (x, y) in d:
12
if s > x:
13
s += y
14
else:
15
result = 'NO'
16
break
17
18
print(result)
19