Finally I found a test that Greedy Solution does not work . :D
this graph is ok :
5 9
2 3
2 4
2 5
3 4
3 5
4 5
1 2
1 3
1 5
4
/|\
1----2----3
\ \|/ |
\---5 |
\-----|
answer is 2 : nodes 1,4
BUT if we have exact copy of this graph with numbers : 1',2',...,5'
and then a node with number ...
Search found 2 matches
- Sat Jul 25, 2015 8:37 pm
- Forum: Volume 1 (100-199)
- Topic: 193 - Graph Coloring
- Replies: 93
- Views: 36737
- Wed Jul 08, 2015 2:14 pm
- Forum: Volume 114 (11400-11499)
- Topic: 11402 - Ahoy, Pirates!
- Replies: 45
- Views: 24901
Re: 11402 - Ahoy, Pirates!
Runtime error gone, but now TLE. :(
I was able to find out the offending statements causing the segmentation fault. Inside "propagate()" function the lines 57, 58, 62, 63, 67, 68 were the culprits - I had not put a condition to end the propagation at the leaf nodes.
Code that's giving TLE is here ...
I was able to find out the offending statements causing the segmentation fault. Inside "propagate()" function the lines 57, 58, 62, 63, 67, 68 were the culprits - I had not put a condition to end the propagation at the leaf nodes.
Code that's giving TLE is here ...