#K38812. Robot Path Validation
Robot Path Validation
Robot Path Validation
This problem involves determining if a robot can visit a sequence of points in a given order. The robot starts at \((0,0)\) and can only move to the right (increasing x-coordinate) or up (increasing y-coordinate). In other words, from a point \((x_1, y_1)\) the robot can only go to a point \((x_2, y_2)\) if \(x_2 \ge x_1\) and \(y_2 \ge y_1\).
You are given \(n\) points. If the robot can visit all these points in the given order under the above conditions, print Yes
; otherwise, print No
.
Note: If there are no points (i.e. \(n = 0\)), the robot trivially satisfies the condition and should output Yes
.
inputFormat
The input consists of multiple lines. The first line contains an integer (n) representing the number of points. Each of the following (n) lines contains two space-separated integers (x) and (y) representing the coordinates of a point. The points must be visited in the order they are given.
outputFormat
Output a single line containing either "Yes" if the robot can visit all points in the given order following the rules, or "No" if it cannot.## sample
3
1 2
3 2
3 4
Yes