From 4014f6a6ef1cbb642ac01bf556e1f8e470200c71 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Wed, 27 Apr 2016 17:55:20 +0800 Subject: [PATCH] Create 1403.cpp --- TYVJ/1403.cpp | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 TYVJ/1403.cpp diff --git a/TYVJ/1403.cpp b/TYVJ/1403.cpp new file mode 100644 index 0000000..8c48852 --- /dev/null +++ b/TYVJ/1403.cpp @@ -0,0 +1,59 @@ +#include +#include +#include +#include +using namespace std; + +#define MAXM 100000 +#define MAXN 20000 +struct ppk +{ + int a,b,c; +}; +bool cmp(const ppk& a,const ppk& b) +{ + return a.c>b.c; +} +int f[MAXN*2]; +ppk X[MAXM]; + +int get(int x) +{ + if(x==f[x]) return x; + else + { + f[x]=get(f[x]); + return f[x]; + } +} + +int main() +{ + int n,m; + scanf("%d %d",&n,&m); + for(int i=1;i<=n*2;i++) + { + f[i]=i; + } + for(int i=0;i