hiho week 14 register

Ended

Participants:423

Verdict:Accepted
Score:100 / 100
Submitted:2014-10-07 14:04:31

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 <map>
using namespace std;
#define maxn 100005
int pa[maxn];
map<string,int> names;
int find(int p){return pa[p]==0?p:pa[p]=find(pa[p]);}
bool uni(int p,int q)
{
    int i=find(p),j=find(q);
    if(i!=j)
    {
        pa[i]=j;
        return true;
    }
    return false;
}
int main()
{
    ios::sync_with_stdio(false);
    int n,cnt=0;
    cin >> n;
    while(n--)
    {
        int c;
        string n1,n2;
        cin >> c >> n1 >> n2;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX