diff --git a/HDOJ/1879.cpp b/HDOJ/1879.cpp new file mode 100644 index 0000000..6d0c10b --- /dev/null +++ b/HDOJ/1879.cpp @@ -0,0 +1,105 @@ +#include +#include +#include +#include +#include +#include +using namespace std; + +#define MAXN 105 +int father[MAXN]; +int noderank[MAXN]; + +void init() +{ + for(int i=0;inoderank[fb]) + { + father[fb]=fa; + } + else + { + father[fa]=fb; + if(noderank[fa]==noderank[fb]) + { + noderank[fb]++; + } + } +} + +struct pack +{ + int a,b,v; +}; +#define MAXM 5000 +pack pk[MAXM]; + +bool cmp(const pack& a,const pack& b) +{ + return a.v