hiho Week 15 register

Ended

Participants:1653

Verdict:Time Limit Exceeded
Score:60 / 100
Submitted:2014-10-13 22:22:39

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 <cstdio>
#include <cstring>
using namespace std;
const int MAXN = 100005;
string st[MAXN];
int cnt;
int tree[MAXN], flag[MAXN];
void add(string father, string son){
    int indF = -1, indS = -1;
    for(int i=0;i<cnt;i++){
        if(father == st[i]) indF = i;
        if(son == st[i]) indS = i;
    }
    if(indF == -1) {st[cnt] = father; indF = cnt++;}
    if(indS == -1) {st[cnt] = son; indS = cnt++; }
    tree[indS] = indF;
}
int findInd(string s1){
    for(int i=0;i<cnt;i++)
        if(s1==st[i])
            return i;
    return -1;
}
void solve(int n1, int n2){
    memset(flag, 0, sizeof(flag));
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX