Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
这题起始点是任意的,判环用BF更好点bool bm() { memset(dist+1, 0, sizeof(dist[0])*L); for(int i = 1; i < L; ++i) { bool flag(true); for(int j = 0; j < rear; ++j) if(dist[u[j]]+w[j] < dist[v[j]]) { dist[v[j]] = dist[u[j]]+w[j]; flag = false; } if(flag) return false; } for(int j = 0; j < rear; ++j) if(dist[u[j]]+w[j] < dist[v[j]]) return true; return false; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator