#K49097. Robots and Charging Stations
Robots and Charging Stations
Robots and Charging Stations
You are given T test cases. In each test case there are n robots. Each robot is initially at a position xi along a line and can travel a maximum distance of di to reach the charging station located at position 0.
A robot can reach the charging station if and only if its initial position satisfies the inequality \( x_i \le d_i \). Your task is to determine for each test case if all robots can reach the charging station.
For each test case, output YES
if every robot meets the condition and NO
otherwise.
inputFormat
The input is given from stdin and has the following format:
T n x1 x2 ... xn d1 d2 ... dn ... (repeated for each test case)
Here, T is the number of test cases. For each test case, the first line contains an integer n, the number of robots; the second line contains n space-separated integers representing the positions \( x_i \); and the third line contains n space-separated integers representing the maximum distances \( d_i \).
outputFormat
For each test case, print a single line to stdout containing either YES
if every robot can reach the charging station (i.e. \( x_i \le d_i \) for all i), or NO
otherwise.
3
3
10 5 15
10 5 15
4
1 10 100 1000
2 20 200 2000
2
50 100
30 70
YES
YES
NO
</p>