解题思路:
好像使用map会超时,所以采用链式哈希。
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn = 2000005;
const long long base = 97;
const int mod = 196613;
char T[maxn];
unsigned long long Hash[maxn];
unsigned long long has[maxn];
int head[maxn], tot;
struct node{
unsigned long long x;
int nxt;
}edges[maxn];
void addEdge(unsigned long long x)
{
// cout << "gg"<< x<<endl;
int u = x%mod;
edges[tot] = {x,head[u]};
head[u] = tot++;
}
char str[maxn];
int Find(unsigned long long x)
{
// co