@sikander_nsit thanks. can’t believe myself
Can someone please tell me what’s wrong with this code? Seems like I used the same approach but still getting 100% WA. Thanks in advance. Here’s the link.
https://www.codechef.com/viewsolution/21347805
You took wrong modulo. Also, distinct function is not needed.
Here’s ur corrected solution.
But what is the exact role of Differentiation in this question, i dont understand?
Thanks a lot !
I don’t understand this editorial. But there was also unofficial editorial of this question which is easy to understand https://discuss.codechef.com/questions/139170/maxprodu-editorial-unofficial?page=1#139371 .
Differentiation is Differentiation, whether its basic or advanced, since calculus wasn’t my cup of tea ever, I’d get scared with even the slightest hint of it
Can somebody explain this test case? If N=50 and K=8, this should be the correct partition: [2;3;4;5;6;7;8;15]
The product is 42674688000, which taken mod 1000000007 is 674687706.
The output of the editorialist’s solution is 734911237.
I did not add the remaining 6 to last element, but to element so that that element becomes a[k-1]+1.
After getting 2 3 4 5 6 7 8 9, My solution add 6 to 4, getting sequence 2 3 10 5 6 7 8 9
which will get the required product.
Thank you!
Please Help I am getting WA in sub-task2 #1
I tried to modify code for overflow problem but i am getting WA
https://www.codechef.com/viewsolution/21628610
Might have worked if used Logarithms, but here, we need the product, not summation.
Plus, Time complexity will be an issue in this solution.
Differentiation is just required for proof of solution.
It is not required to solve the problem if you get the intuition of solution.