I am trying to solve “Walk or Train Problem”, but getting run time error (SIGSEGV) every time, i tried to find what causes the issue in code but can’t find one. Please help me to find the bug. I might be using the old way to do stuff in c++ as i learn it few years ago, i’m also new to competitive programming but not to coding in general. So i’ll appreciate some advice for a beginner
thanks for letting me know about code formatting @ssjgz, i tried your testcase on my local PC IDE and output is 6 both times, it is a sample testcase from the problem and i already tested it many time on my IDE, but the problem is whenever i run my code on codechef IDE, it throws “Runtime Error” showing “SIGSEGV” in the output. And about WA, i just submit my solution anyways and codechef count it as wrong answer. I just edit my post and attached Screenshot.
Do i need to explicity apply all constraints in the solution since inputs are taken by user? I see others correct submissions but no one apply constraint in the solution and fun fact is that i tried to run many correct submissions on my codechef IDE, but it still throws same runtime error on those submissions too.