hiho week 129 register

Ended

Participants:225

Verdict:Accepted
Score:100 / 100
Submitted:2016-12-22 15:14: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
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstring> // strlen
#include<cmath>
#include<set>
#include<queue>
#include<map>
#include<string>
#include<limits.h> // INT_MAX
#include<functional>
#include<algorithm>
#include<stack>
using namespace std;
const int maxn = 1e6+3;
typedef long long LL;
// SAM: suffix auto machine
// 
int NEXT_FREE_IDX = 0;
int maxlen[2*maxn+10], minlen[2*maxn+10], trans[2*maxn+10][26], slink[2*maxn+10]; //add1
int edpts[2*maxn+10],indegree[2*maxn+10], containPrefix[2*maxn+10];
int new_state( int _maxlen, int _minlen, int* _trans, int _slink){
    // 
    maxlen[NEXT_FREE_IDX] = _maxlen;
    minlen[NEXT_FREE_IDX] = _minlen;
    for( int i(0); i < 26; i++ ){
        if( _trans==NULL )
            trans[NEXT_FREE_IDX][i] = -1;
        else
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX