#C1680. Minimum Operations to Empty a Stack
Minimum Operations to Empty a Stack
Minimum Operations to Empty a Stack
You are given two stacks of plates. In each operation, you can remove the top plate from either stack. Your task is to determine the minimum number of operations required to completely empty one of the stacks. Given two stacks with sizes ( n ) and ( m ) respectively, the answer for each test case is ( \min(n, m) ).
Input/Output Details: The input is taken from standard input (stdin) and the output should be printed to standard output (stdout). For each test case, you will be provided with the sizes of the two stacks and the list of plates in each stack. Although the values on the plates are given, they do not affect the answer. Your solution is to simply output ( \min(n, m) ) for each test case.
inputFormat
The first line of input contains a single integer ( T ) representing the number of test cases. For each test case:
- The first line contains two space-separated integers ( n ) and ( m ), the number of plates in stack A and stack B respectively.
- The second line contains ( n ) space-separated integers representing the plates in stack A.
- The third line contains ( m ) space-separated integers representing the plates in stack B.
Note that the values on the plates are irrelevant to the solution.
outputFormat
For each test case, output a single integer on a new line representing the minimum number of operations required to empty one of the stacks, i.e., ( \min(n, m) ).## sample
1
5 4
1 2 3 4 5
6 7 8 9
4
</p>