All Submissions


There are N trees arranged in a straight horizontal line numbered 1 to N from left to right. The distance between treei and treei+1 is di, and the height of treei is hi.
To make them look beautiful, you try make the topmost points of all the trees collinear. You are allowed to cut the tress by any length (not necessarily an integer). Different tress can be cut by different lengths. What is the minimum number of trees you need to cut?

Input
First line contains the number of test cases.
Each test case has three lines, first line has single integer N. Second line has N-1 integers d1...dN-1, third line contains N integers h1...hN.

Output
Print one line per test case containing one integer representing the minimum number of trees you need to cut.

Constraints
Test cases < 300
1 <= N <= 50
1 <= di <= 1000
1 <= hi <= 1000

Sample Input
5
3
2 2
1 3 10
3
3 3
3 1 3
3
1 3
4 4 4
3
4 2
9 8 5
3
2 2
2 1 2


Sample Input
1
2
0
1
1


Explanation


Problem Setter : Shikhar Sharad

Languages: Brain,C,C++,Java,C#,JavaScript,Pascal,Perl,PHP,Python,Ruby,Text

Time Limit: 3 Second(s)
Score: 100 Point(s)
Input File Limit: 50000 Bytes

Submit

Login to post clarification.

No Clarifications.

Contest

Mode Judge

Passive

Online

Overall Rankings

RankNameScore
1xyz0
2Ams0
3TIP0
4team420
5xyzz0
6asdasdasd0
7abcd0
8khankhan0
9Gabriel0
10gigel0