摘要: 掌握无向图欧拉回路存在的充要条件:连通且所有点的度数为偶数。这里采用并查集判断是否连通,只要把每条边的两个顶点合并,最后判断是否有顶点不在这个集合里就可知是否连通。在并查集合并时没有判断要合并的顶点是否已经在一个集合中,导致产生集聚,多次TLE,自己真的很水啊。View Code #include <iostream>#include <cstring>using namespace std;const int MAX = 1005;int n,m,degree[MAX],root[MAX];void makeSet(){ for(int i = 1;i <= n 阅读全文
posted @ 2011-03-26 09:22 c++fans 阅读(611) 评论(0) 推荐(0) 编辑