hiho week 27 register

Ended

Participants:637

Verdict:Accepted
Score:100 / 100
Submitted:2015-01-05 08:16:44

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#include <stdio.h>
#include<string.h>
#include<math.h>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int pre[100005];
struct node
{
    int x,y,l;
};
node a[1000006];
int find(int x)
{
    if(pre[x]==-1) 
        return x;
    return pre[x]=find(pre[x]);
}
int cmp(node a,node b)
{
    return a.l<b.l;
}
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    memset(pre,-1,sizeof(int)*(n+2));
    for(int i=0;i<m;i++)
        scanf("%d%d%d",&a[i].x,&a[i].y,&a[i].l);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX