From 3d9595270bb603f9e1ef33bc42116d491a32d7c1 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Wed, 27 Apr 2016 16:17:02 +0800 Subject: [PATCH] Create 600.cpp --- RQNOJ/600.cpp | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 RQNOJ/600.cpp diff --git a/RQNOJ/600.cpp b/RQNOJ/600.cpp new file mode 100644 index 0000000..06c4289 --- /dev/null +++ b/RQNOJ/600.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