Vivek homework hackerblock

output is correct in other compiler…
but in hackerblock it is showing wrong answer

Pleas provide the link of the question on hackerblocks .

sure.
https://hack.codingblocks.com/app/practice/1/70/problem

Check the constraints:
Constraints
1 <= N <= 10^5 1 <= A[i] <= 10^10

Since they are large enough. So use long long int instead of int. Also change the data type of array to long long int.

i am already using long long int.
kindly check

Your approach will not work for very large input. Since you are just multiplying all the numbers to check.
Each number can be of order 10^10, so multiplying all of them will result in a very huge number which cannot be store in any datatype.
Consider an i/p
5
690715844 967573868 1501528738 1497214228 1046512263
and check yourself

Follow this for the approach:


or
https://www.tutorialspoint.com/find-minimum-value-to-assign-all-array-elements-so-that-array-product-becomes-greater-in-cplusplus

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.