I’m not able to figure out what is it that I’m doing wrong. Please help asap!
Syntax error leading to segmentation fault
@vatsal38 but we are using 1 based indexing. Even if I do adj[0].push_back({0, 0})
before taking the inputs (i.e. after line 51), I still end up getting the same error
@sufia.aleena12 you have only declared adj it contains no space so if you do a[0] it will give segment
you can use array of vectors then it should work
Here it is
I think your solution is incorrect because the diagonal elements should be zero always.
Kindly check my solution.
@vatsal38 I followed exactly the same approach as in the video. But since the input is in 1 based indexing, I’m facing an issue. My logic is correct though. Upon dry running I don’t get wrong asnwers. Only the indexing is an issue.
Nothing has changed here. Only that we are storing 99999 initially instead of INT_MAX.
Actually the output should be :
0 3 4 4
3 0 1 1
4 1 0 2
4 1 2 0
@sufia.aleena12 if you want output at bhs just make edge from y to x too here refer this
just added 1 line
Such a silly mistake Thanks a lot
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.