From c792923c7fce1f8ecd38a333c13d67f6b377f16d Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Tue, 3 May 2016 14:52:51 +0800 Subject: [PATCH] Create 1879.cpp --- HDOJ/1879.cpp | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 HDOJ/1879.cpp 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