Home > Back-end >  To solve this problem
To solve this problem

Time:12-15

This is a very interesting game, here, you will be a brave, and customs clearance condition is: you beat all the dragon, the beginning of the game, you get an initial damage a, when fighting dragons, if your damage is greater than its damage, you can beat the dragon and get hit it provides note: defeat a dragon hit will not make you down, you can challenge the dragon according to oneself to like order,



The first line is two positive integers a, n, a, representing the initial damage, n represents the number of dragon,

Then n lines, each line contains two positive integers x, y, x represents the dragon fire damage, y represent the dragon bonus fire damage to

The size of the data within 1000,



If you can customs clearance, output YES; Otherwise the output NO, don't break,

CodePudding user response:

Throw brick:
In descending order of y, then start from scratch every time to find the first soft persimmon bullying,
  • Related