hiho week 130 register

Ended

Participants:182

Verdict:Accepted
Score:100 / 100
Submitted:2016-12-25 16:27: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 <cstdio>
#include <cstring>
#include <queue>
using namespace std;
typedef long long LL;
const int MAX = 1001000, MOD = 1000000007;
int n = 0;
int maxlen[2 * MAX], minlen[2 * MAX], trans[2 * MAX][11], slink[2 * MAX];
char input[MAX];
LL sum[2 * MAX], indegree[2 * MAX], num[2 * MAX];
int newState(int _maxlen, int _minlen, int *_trans, int _slink){
    maxlen[n] = _maxlen;
    minlen[n] = _minlen;
    for(int i = 0; i <= 10; ++i){
        if(_trans == NULL){
            trans[n][i] = -1;
        }else{
            trans[n][i] = _trans[i];
        }
    }
    slink[n] = _slink;
    return n++;
}
int addChar(int u, char ch){
    int c = ch - '0';
    int z = newState(maxlen[u] + 1, -1, NULL, -1);
    int v = u;
    while(v != -1 && trans[v][c] == -1){
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX