Question: https://www.codechef.com/problems/DIANE

My code: https://www.codechef.com/viewsolution/39042632

My approach was that I print 3 integers “2*d 3*d 1” as the answer. The gcd of the first 2 elements is d and the minimum is 2*d. So the difference is d.

In all other subarrays the value of min - gcd is 0.

So the sum among all subarrays comes out to be d.

For d == 0, I just printed 1 as the output.

What is wrong with this approach?