hiho Week 15 register

Ended

Participants:1653

Verdict:Time Limit Exceeded
Score:70 / 100
Submitted:2014-10-18 10:57: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 <string>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
struct A{
    A* parent;
    string name;
    int visited;
    A(string name):name(name),parent(NULL),visited(0){}
    //bool operator<(A& a){return name<a.name;}
};
int main(){
    int n;
    int m;
    cin>>n;
    map<string, A*> ma;
    for(int i=0;i<n;i++){
        string n1,n2;
        cin>>n1>>n2;
        if(ma[n1]==0){
            A* a1 = new A(n1);
            ma[n1]=a1;
        }
        if(ma[n2]==0){
            A* a2 = new A(n2);      
            ma[n2]=a2;
        }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX