hdu5558 Alice's Classified Message (后缀数组)
后缀数组
首先计算出sa, rank, height数组,
易知,不妨设x, y(rank[x]
利用这个这个性质,便很容易在枚举的时候做出一些剪枝:
假设当前位置为p,则可以从rank[p]开始分别向两边进行枚举,当枚举到minHeight
这样的话可以在1s内运行完
#include
#include
#include
using namespace std;
//后缀
原创
2015-11-14 17:37:44 ·
928 阅读 ·
0 评论