307290: CF1334A. Level Statistics
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Level Statistics
题意翻译
### 题目大意 Polycarp 在 $n$ 个时间点查看了用户的游戏记录。他想知道他有没有搞砸这些记录。 - 当用户通关后,不仅清除次数 $c_i$ 会增加,游戏次数 $p_i$ 也会随之增加。 - 游戏记录是按照时间顺序给出的,这些时间点有可能相同。所以,清除次数和游戏次数不可能减少。 现在给出 $t$ 个玩家的游戏记录,需要你求出每个玩家的游戏记录是否已经被 Polycarp 搞砸了。题目描述
Polycarp has recently created a new level in this cool new game Berlio Maker 85 and uploaded it online. Now players from all over the world can try his level. All levels in this game have two stats to them: the number of plays and the number of clears. So when a player attempts the level, the number of plays increases by $ 1 $ . If he manages to finish the level successfully then the number of clears increases by $ 1 $ as well. Note that both of the statistics update at the same time (so if the player finishes the level successfully then the number of plays will increase at the same time as the number of clears). Polycarp is very excited about his level, so he keeps peeking at the stats to know how hard his level turns out to be. So he peeked at the stats $ n $ times and wrote down $ n $ pairs of integers — $ (p_1, c_1), (p_2, c_2), \dots, (p_n, c_n) $ , where $ p_i $ is the number of plays at the $ i $ -th moment of time and $ c_i $ is the number of clears at the same moment of time. The stats are given in chronological order (i.e. the order of given pairs is exactly the same as Polycarp has written down). Between two consecutive moments of time Polycarp peeked at the stats many players (but possibly zero) could attempt the level. Finally, Polycarp wonders if he hasn't messed up any records and all the pairs are correct. If there could exist such a sequence of plays (and clears, respectively) that the stats were exactly as Polycarp has written down, then he considers his records correct. Help him to check the correctness of his records. For your convenience you have to answer multiple independent test cases.输入输出格式
输入格式
The first line contains a single integer $ T $ $ (1 \le T \le 500) $ — the number of test cases. The first line of each test case contains a single integer $ n $ ( $ 1 \le n \le 100 $ ) — the number of moments of time Polycarp peeked at the stats. Each of the next $ n $ lines contains two integers $ p_i $ and $ c_i $ ( $ 0 \le p_i, c_i \le 1000 $ ) — the number of plays and the number of clears of the level at the $ i $ -th moment of time. Note that the stats are given in chronological order.
输出格式
For each test case print a single line. If there could exist such a sequence of plays (and clears, respectively) that the stats were exactly as Polycarp has written down, then print "YES". Otherwise, print "NO". You can print each letter in any case (upper or lower).
输入输出样例
输入样例 #1
6
3
0 0
1 1
1 2
2
1 0
1000 3
4
10 1
15 2
10 2
15 2
1
765 432
2
4 4
4 3
5
0 0
1 0
1 0
1 0
1 0
输出样例 #1
NO
YES
NO
YES
NO
YES