Wednesday, March 23, 2022

Economics Class

 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
— the number of test cases. The description of
  • test cases follows.
  • Each test case contains three lines of input.
  • The first line of each test case contains an integer
  • , the length of the arrays and
  • .
  • The second line of each test case contains
  • space-separated integers
  • .
  • The third line of each test case contains
  • space-separated integers
    • .

    Output Format

    For each test case, output the number of time points at which the market was in equilibrium.

    Constraints

  • for every

    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

    मुझे दिल में बसाना आसान नहीं....

    पता है Recently i realised की मुझे दिल में बसाना आसान नहीं है बात-बात पे चिढ़ जाती हूं मैं दिल लगा लूं एक बार तो फिर ज़िद पे अड़...