WA on PCAKE LOC JUNE 2017

Link to question : https://www.codechef.com/LOCJUN17/problems/PCAKE

Link to solution : https://www.codechef.com/viewsolution/14402430

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