Given two arrays a and b of size n and m respectively. Find the number of ways to partition the array a into m partitions, such that for the i-th partition, max of its elements is equal to b_i.
Find the bug in the code.
There is no logical bug in this question. The only bug is that the program returns from the solve() function without reading the complete input for the ongoing test case. Because of this the next test case which the program reads contains unread input from the current test case, which leads to wrong input for the next test case, further leading to wrong solution.
2 3 5 1 2 3 5 4 3 2 1 4 2 4 3 2 1 4 3
The correct output for the given test case will be:
The program will read first line of first test case and return from solve(). Next the program will read second line of first test case as input for second test case and again return from solve(). Hence, the program will output: