From b05eee28b1f655b8352eaa4419a9ae4c3c3b49f5 Mon Sep 17 00:00:00 2001 From: Muhammad Nauman Raza Date: Tue, 14 Jan 2025 22:52:41 +0000 Subject: [PATCH] solutions: 230A --- solutions/230A.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 solutions/230A.py diff --git a/solutions/230A.py b/solutions/230A.py new file mode 100644 index 0000000..ab7529d --- /dev/null +++ b/solutions/230A.py @@ -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")