#P1373F. Network Coverage
Network Coverage
No submission language available for this problem.
Description
The government of Berland decided to improve network coverage in his country. Berland has a unique structure: the capital in the center and cities in a circle around the capital. The capital already has a good network coverage (so the government ignores it), but the -th city contains households that require a connection.
The government designed a plan to build network stations between all pairs of neighboring cities which will maintain connections only for these cities. In other words, the -th network station will provide service only for the -th and the -th city (the -th station is connected to the -th and the -st city).
All network stations have capacities: the -th station can provide the connection to at most households.
Now the government asks you to check can the designed stations meet the needs of all cities or not — that is, is it possible to assign each household a network station so that each network station provides the connection to at most households.
The first line contains a single integer () — the number of test cases.
The first line of each test case contains the single integer () — the number of cities and stations.
The second line of each test case contains integers () — the number of households in the -th city.
The third line of each test case contains integers () — the capacities of the designed stations.
It's guaranteed that the sum of over test cases doesn't exceed .
For each test case, print YES, if the designed stations can meet the needs of all cities, or NO otherwise (case insensitive).
Input
The first line contains a single integer () — the number of test cases.
The first line of each test case contains the single integer () — the number of cities and stations.
The second line of each test case contains integers () — the number of households in the -th city.
The third line of each test case contains integers () — the capacities of the designed stations.
It's guaranteed that the sum of over test cases doesn't exceed .
Output
For each test case, print YES, if the designed stations can meet the needs of all cities, or NO otherwise (case insensitive).
Samples
Note
In the first test case:
- the first network station can provide connections to the first city and connection to the second city;
- the second station can provide connections to the second city and connection to the third city;
- the third station can provide connections to the third city.
In the second test case:
- the -st station can provide connections to the -st city;
- the -nd station can provide connections to the -nd city;
- the -rd station can provide connections to the -rd city and connection to the -st station.
In the third test case, the fourth city needs connections, but the third and the fourth station has connections in total.