I was solving CHEFTMA and read it’s Editorial but couldn’t completely understand the part where it says “The black and white buttons fundamentally do the same things when dealing with the modified values of the array A”. I understand that both arrays C and D help in reducing the element’s value of the modified array A. So, they put both array C and D in a multiset.But array C was linked with original array A and array D was linked with original array B. There were constraints associated with using array C’s elements and array D’s elements. How do we ensure that using them in the same multiset with modified array A doesn’t violate the constraints?
1 Like
Try to not think in terms of A and B. Consider only the values of A[i]-B[i], which is the number of tasks left incomplete on day i. From this point of view, the values in C and D do the same thing: they decrease the number of tasks left incomplete. It is no longer essential to keep track of how this is happening, the effect on the number of tasks left incomplete is the same whether we decrease the total number of tasks or increase the number of completed tasks.
1 Like
OK.Thanks!!