My code is not working on codeblocks but is working on online compiler.
It shows filename.exe has stopped working without taking any input
link to code :
My code is not working on codeblocks but is working on online compiler.
It shows filename.exe has stopped working without taking any input
link to code :
hey you should declare bool ar[a+1] after scaning the value of a.
If you still have any problem feel free to comment.
I think it’s memory error because variable a holds some garbage value initially until it’s declared hence when u declare an array i.e bool ar[a+1] it exits due to failure of memory allocation. Try moving bool ar[a+1] below fastscan(a).
Also in this code
All testcase works fine but for particulary this input it prints garbage value.
testcase :
9 10
1 2 3 4 5 6 7 8 9
1 5
5 6
6 7
5 7
9 1
1 2
2 8
2 3
3 4
2 4
I got this output by running your code-
value of node1
5 9 2
value of node2
1 8 3
value of node3
2 0
value of node4
0
value of node5
1 6 7
value of node6
5 7
value of node7
6 5
value of node8
2
value of node9
1
I cant see any garbage value here
And what is the question? Debugging code without knowing the purpose of code is like shooting an arrow in dark.
ohh my bad!!
thanks
Also in this code
All testcase works fine but for particulary this input it prints garbage value.
testcase :
9 10
1 2 3 4 5 6 7 8 9
1 5
5 6
6 7
5 7
9 1
1 2
2 8
2 3
3 4
2 4
Actually i figured out it was problem of using fastscan()
it was taking space as input when i was copying testcase .