hiho week 120 register

Ended

Participants:410

Verdict:Accepted
Score:100 / 100
Submitted:2016-10-16 10:52:25

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 <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <list>
#include <queue>
using namespace std;
#define MAXN 20003
typedef unsigned long long ULL;
ULL hhash[MAXN];
ULL xp[MAXN];
ULL h[MAXN];
int data[MAXN];
int x = 2333;
int slen;
bool check(int len, int k)
{
    for(int i = 0; i < slen-len+1; i++)
        hhash[i] = h[i]-h[i+len]*xp[len];
    sort(hhash, hhash+slen-len+1);
    int t;
    for(int i = 0; i < slen-len+1; i++)
    {
        if(i == 0 || hhash[i] != hhash[i-1])t = 0;
        if(++t >= k)return true;
    }
    return false;
}
int main()
{
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX