Alice has recently learned in her economics class that the market is said to be in equilibrium when the supply is equal to the demand.
Alice has market data for
time points in the form of two integer arrays and . Here, denotes the supply at the point of time and denotes the demand at the point of time, for each.
Help Alice in finding out the number of time points at which the market was in equilibrium.
Input Format
- The first line of input will contain an integer
- .
Output Format
For each test case, output the number of time points at which the market was in equilibrium.
Constraints
Sample Input 1
2
4
1 2 3 4
2 1 3 4
4
1 1 2 2
1 2 1 1
Sample Output 1
2
1
Explanation
Test case
: For and, we have supply equal to demand, hence the market is in equilibrium.
Test case
: For , we have supply equal to demand, hence the market is in equilibrium.
No comments:
Post a Comment