Can you make a water problem?

Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)

Problem Description

Losanto want to make a water problem. But he have no idea….
Then he thought a problem: A bus arrived at a station, and there were x persons got off the bus, then y persons got on the bus. And there were r persons(include the driver) on the bus before the bus arrived at next station. How many person on the bus initially? The driver can’t get on or off the bus. There is only 1 driver in the bus.
But if the x=8 , y=5 r=4, there are something wrong in the problem. After got on 5 persons and there are 4 persons rest…What a pity! Losanto give you x, y, r want know whether the problem is OK.
Of course few buses has only one station, so there are n stations.
Now give you x and y for every station, and there is only one person (the driver) rest after the last station. Can you find a suitable order for the station to make the problem OK?

Input

There are several cases.

For each case, First line there is a n, indicate n stations. Then n lines followed, each line has two numbers xi and yi. To make the problem easier, we guarantee that xi>=yi.(0<n<100000  0<=xi,yi<1000000)

Output

For each cases, output one line with “Yes” (if you can make an OK order) or “No” (if you can’t).

Sample Input

2
5 0
7 4
2
5 2
3 3

Sample Output

Yes
No

Source

第九届北京化工大学程序设计竞赛

Manager

Information
Solved Number143
Submit Number430
Problem Tags
greedy
No tag edit access
温馨提示:AC后可以编辑标签哦. ^-^
Login
LoginCancel