hiho Week 15 register

Ended

Participants:1653

Verdict:Accepted
Score:100 / 100
Submitted:2014-10-12 22:09:13

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 <cstdio>
#include <cstring>
#define N 100010
int ct=1;
int nm=1;
char s[N][60];
struct node{
    int num;
    int next[70];
};
node e[30*N];
struct tree{
    int to,next;
    int index;
}rt[N],qt[N*2];
int rh[N],qh[N];
int getnum(char *t){
    int s=0,i;
    for(i=0;t[i];i++){
        int x=t[i]-'A';
        if(e[s].next[x]){
            s=e[s].next[x];
        }else{
            e[s].next[x]=ct++;
            s=e[s].next[x];
        }
    }
    if(e[s].num==0) e[s].num=nm++;
    return e[s].num;
}
int p[N];
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX