Running Rivalry
Alice and Bob have taken up running and are interested in tracking their progress by comparing their daily distances.
For a stretch of days, Alice ran meters and Bob ran meters on day .
On any given day,
- Alice feels discontent if Bob's distance is more than double hers, and content otherwise.
- Bob feels discontent if Alice's distance is more than double his, and content otherwise.
For instance, on a specific day:
- Should Alice run meters and Bob , Alice would be discontent while Bob would be content.
- Should Alice cover meters and Bob , Alice would be content while Bob would be discontent.
- If Alice runs meters and Bob , both would find contentment.
Determine the number of days where both Alice and Bob felt content.
Input Format
- The initial line of input presents a single integer , representing the count of test cases.
- Each test case is divided into three lines.
- The opening line of a test case states a single integer — the count of days.
- The subsequent line lists integers separated by spaces — the distances Alice ran each day.
- The last line also lists integers separated by spaces — the distances Bob ran each day.
Output Format
For every test case, report in a new line the tally of days when both Alice and Bob were content.
Constraints
Sample Test Cases (with explanations)
Case #1:
Input:
4 3 100 200 300 300 200 100 4 1000 1000 1000 1000 400 500 600 1200 4 800 399 1400 532 2053 2300 3400 23 5 800 850 900 950 1000 600 800 1000 1200 1400
Output:
1 3 0 5
Explanation
Test case : Alice is discontent on the first day, as her meters is significantly less than Bob's ; Bob's distance being over twice of Alice's.
On the contrary, Bob is discontent on the third day.
The second day sees both Alice and Bob content, leading to the answer being .
Test case : Day has Bob discontent but content on the remaining days, whereas Alice is content throughout, making them both content on three days — the second, third, and fourth days.
Test case : Days see Alice discontent and day sees Bob discontent.
Test case : Across all five days, both Alice and Bob are content.