CC's

Back

You are given a string S consisting of only lowercase english letters and some queries.

For each query (l,r,k), please output the starting position of the k-th occurence of the substring SlSl+1…Sr in S.

分析#

第一个问题是快速找出所有出现的子串的位置,可以使用后缀数组.这些字串出现在sa的一个连续的区间中.

第二个问题是找出这些出现位置中的第k大,可以使用主席树,以sa建树.

代码#

思路清晰,但这代码它不好写

[HDU 6704] Kth Occurrence
https://astro-pure.js.org/blog/hdu-6704-kth-occurrence
Author Cheng Chen
Published at 2019年8月25日
Comment seems to stuck. Try to refresh?✨