Runtime Error(SIGSEGV) in TRIPS

Hello! I’m getting Runtime Error(SIGSEGV) in trips. Would anybody help me find out the error!
problem link:
solution link:
I’ve also tried the int long to long long , long unsigned…but getting the same error.

The size of your array is n so the highest index you can access is n-1 but you are accessing index n as well so declare a bigger array.


I’ve increased the array size and optimize the code …But…
still getting W.A.
solution link:
cud u suggest me the test cases where the code is failing…thanks!!

Your corrected code :

1 Like

seems like you are using a matrix to represent the graph which won’t work because n <= 10^5. Your approach seems wrong too. Have you read the Editorial ? If not read it and any data structure or algorithm you don’t understand learn it from here :

@topcoder_7 Atleast explain where he’s going wrong or give some hint. Directly giving him the solution is not going to help him.

1 Like

If he compares the solution he’ll know. I’ve include the part which he has to remove from his code in comment region(/***/)

1 Like