↵
Given an array of n elements, divide into the minimum number of consecutive of subarrays that satifies the following conditions or determine if that is impossible:↵
↵
+ Every element belongs to an exact subarray↵
↵
+ The median of each subarray must be non-negative↵
↵
+ Let array B be the array of the medians of the subarrays. The average of all elements of B must be be d (d is given)↵
↵
+ Let array C be the array of the averages of each subarray. The median of C should be k (k is given)↵
↵
+ B and C are both non-decreasing.↵
↵
Please help. Thank you in advance!