摘要:
dij SPFA 负环和差分约束之前写程序设计作业的时候就了解过spfa和差分约束,这里再解释一下 负环: 一个边权和为复数的环称为负环。不难知道,如果图中存在负环,那么无论经过多少次迭代,总存在有向边(x,y,z)使得dist[y] > dist[x] + z则spfa算法无法结束。 根据抽屉原理 阅读全文
摘要:
Given a connected undirected graph, tell if its minimum spanning tree is unique. Definition 1 (Spanning Tree): Consider a connected, undirected graph 阅读全文
摘要:
There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each other. We say t 阅读全文
摘要:
You are a member of the space station engineering team, and are assigned a task in the construction process of the station. You are expected to write 阅读全文
摘要:
克鲁斯卡尔 普里姆 阅读全文