WA on PCAKE LOC JUNE 2017

Link to question : CodeChef: Practical coding for everyone

Link to solution : CodeChef: Practical coding for everyone

Need testcase for which this code fails

The constraint is too high for your code. You just can not multiply and check, it will exceed the range of long long in 4th sub task. (Use python(with some optimization…) if u want to do it in your way…)

failing test case-

1

20

2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71

these are all prime numbers(also all elements are unique), so every segment will be good.

expected answer-210, your answer-206(wrong answer due to over flow).

try changing your approach or use python.

1 Like