hiho Week 13 register

Ended

Participants:460

Verdict:Accepted
Score:100 / 100
Submitted:2014-09-28 21:05:57

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 <string>
#include <map>
#include <cstring>
#include <cstdio>
using namespace std;
map<string,int> pos;
string name[10000];
int tree[10000]={0};
bool is[10000];
int size=1;
int main()
{
    //freopen("in.txt","r",stdin);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        string f,s;
        cin>>f>>s;
        if(!pos[f]){
            name[size]=f;
            pos[f]=size;
            size++;
        }
        if(!pos[s]){
            name[size]=s;
            pos[s]=size;
            size++;
        }
        tree[pos[s]]=pos[f];
    }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX