[Normal]POJ1743 - Musical Theme
The longest non-overlapping common prefix.

Algorithm: Get the SA array and Height array. Then use the dichotomy on result. The judgement step is like this: For each i, find largest j make rmq(i, j)>=result (It means Height[j+1]<result). If max(sa[i..j])-min(sa[i..j]) no less than result, the result is valid and answer may bigger. Or continue finding next interval, start at j+1 (think why).

Special Process in this problem: For the judging result R, the valid interval is rmq(i, j)>=R-1, the valid max(sa[i..j])-min(sa[i..j]) is R (think why).

Wrong Submit:
1). The special case n=1

2). In my code, the ineterval is [i, j). But my next start is i=j+1.

3). Forgot to return 0 if no valid result find.