Help needed with cookoff problem


My code:

My approach was that I print 3 integers “2d 3d 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?

2d and 3d exceeds limits of 10^5 , so its wrong

According to constraints, 2d and 3d can be greater than the required Ai value<=10^5