I did the same thing as told in the editorial getting the maximum of the 3 numbers m times and then halving it . Even then i was getting WA . It would be great if someone points out what is wrong in the given code .
This does not seem correct, may be try the limit 90 as explained in the editorial.
@goltu Dude the order of input is red green and blue. check your order of input ans also why are using the following statement:
remove this statement. Check this. It the AC version of your code.
Why does he even do that? m>=30 then m=30? Just cant see how is this helpful in any possible way!
Based on the limit on the values in R, G, B, one can observe that using at most 90 operations, all values can be made zero. Hence, there is no point of applying more than 90 operations.
Like I said in the editorials that this optimization has little merit given that the maximum allowed value of m is 100. On the other hand, if m were allowed to be large (e.g., 109), this could have saved time.
I removed this condition even then it’s giving WA .
Meanwhile I used this condition earlier because the values in the arrays are less than 10^9. So if we divide them with 2 more than 30 times then denominator will be greater than 10^9 making them zero .
ThankYou so much . I don’t know how I missed out this minor detail .
@roman28 I used this condition earlier because the values in the arrays are less than 10^9. So if we divide them with 2 more than 30 times then denominator will be greater than 10^9 making them zero .