リンクのG題: http://codeforces.com/gym/100548
1.回文樹ができないので、タイトルを見るとSAM
2.よく考えてみると、SAMの1つのノードが表す文字列は、せいぜい1つだけが回文列であることがわかります.
同じアルファベットで終わる異なる文字列が現れる位置が完全に同じとは限らない.
長さnのシリアル種が現れる回文サブシリアル種がn種を超えないことを説明する
3.ノードに格納されている文字列に文字列があるかどうか、新しいノードを作成するときにどのように判断しますか?
もしあるならば、必然的に現在の文字で終わる最も長いその回文列です
Manacherは最長の長さを処理します.それからminlen[cur]以上かどうかを比較すればいいです.
4.SAMの前のノードに一致する場合、具体的にどのくらい追加しますか?
現在一致する文字列の長さをlenと仮定
それはlenより短い文列がパターン列に現れる回数を加える.
具体的にはsuffix_linkは探しに行って、その出現の回数に乗ることを覚えています
5.ついでに振り返ってみると、回文樹でできるような、SAM+manacherでもできる?
#include
#include
#include
#include
#include
#include