If you have TLE- be careful with comparing doubles while searching negative cost cycle
Change
if (d[j] > d + a[j])
with
if (d[j] > d + a[j] + eps)
Search found 2 matches
- Mon Sep 10, 2007 3:00 pm
- Forum: Volume 107 (10700-10799)
- Topic: 10746 - Crime Wave - The Sequel
- Replies: 27
- Views: 22106
- Sat Oct 14, 2006 9:55 pm
- Forum: Volume 7 (700-799)
- Topic: 793 - Network Connections
- Replies: 102
- Views: 47649
There is a great article about "Union Find operation" algorithm here:
http://valis.cs.uiuc.edu/~sariel/teach/ ... /22_uf.pdf
http://valis.cs.uiuc.edu/~sariel/teach/ ... /22_uf.pdf