#NINJA7. TWO SEQUENCES PROBLEM

TWO SEQUENCES PROBLEM

Problem statement:

 

Given two lists A and having the same length, find the length of longest subsequence of list A, whose sum is greater than or equal to the corresponding subsequence of list B. Corresponding subsequence means indices chosen in both of the lists must be the same.

 

Input format:

 

The first line contains an integer T , the number of test cases.

Then for each test cases, there are 3 lines.

The first line has an integer N, the number of elements in the lists A& B.

The second line contains N integers of the list A.

The third line contains N integers of the list B.

 

Output format:

For each test case, print the answer in a single line.

 

Constraints:

1 < T < 50

1 ≤ N ≤ 10^5
0≤A[i]≤10^7
0≤B[i]≤10^7

Sample input:

1

3

100 100 5

2 2 1000

 

Output:

2