为什么如下回文树在 c++14 和 c++17 下运行结果会不一样啊。。。
struct Pam {
int len[N], fail[N], dep[N], siz, tot, lst; char ch[N];
vector<pair<char, int> > to[N];
int To(int p, char ul) {
for(pair<char, int> x : to[p])
if(x.fi == ul) return x.se;
return 0;
}
int node(int l) { len[++siz] = l; to[siz].clear(); return siz; }
void init(void) { siz = -1; fail[node(0)] = node(-1); ch[tot = lst = 0] = '$'; }
int get_fail(int p) { while(ch[tot - len[p] - 1] ^ ch[tot]) p = fail[p]; return p; }
int insert(char ul) {
ch[++tot] = ul; int p = get_fail(lst);
if(!To(p, ul)) {
int x = node(len[p] + 2);
fail[x] = To(get_fail(fail[p]), ul);
to[p].push_back(make_pair(ul, x));
dep[x] = dep[fail[x]] + 1;
} return dep[lst = To(p, ul)];
}
} p;