×

SIGSEGV error in BLINNET

 0 Here is the link to question : http://www.spoj.com/problems/BLINNET/ Link to my solution : https://repl.it/@NikhilAgrawal/BLINNET While submitting the solution, it's showing sigsegv error which occurs due to invalid memory referrence but I don't see that happening in my code. I have already tried for more than a hour to fix it but to no avail. Can someone please help me find it? TIA! asked 12 Mar, 22:39 4★kaneki13 39●5 accept rate: 0%

 0 Why are you using const in bool comp(const node l,const node r) { return l.cost < r.cost; }  second, you are using long long int at every place which you don't need to. and you are using lld root(lld nodes) { if (parent[nodes] != nodes) parent[nodes] = root(parent[nodes]); return parent[nodes]; }  which might call recursively many time itself maybe causing that error. use only int main() instead of int main(void) answered 12 Mar, 23:59 1★rds_98 30●5 accept rate: 4% That is not the case because when I replace my edge array with vector it passed which simply signifies that comp and root function don't have any bug! (13 Mar, 14:42) kaneki134★
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×17