LCS2 - Longest Common Substring II
A string is finite sequence of characters over a non-empty finite set Σ.
In this problem, Σ is the set of lowercase letters.
Substring, also called factor, is a consecutive sequence of characters occurrences at least once in a string.
Now your task is a bit harder, for some given strings, find the length of the longest common substring of them.
Here common substring means a substring of all the considered strings.
The input contains at most 10 lines, each line consists of no more than 100000 lowercase letters, representing a string.
The length of the longest common substring. If such string doesn't exist, print "0" instead.
Input: alsdfkjfjkdsal fdjskalajfkdsla aaaajfaaaa Output: 2
Notice: new testcases added
I got TLE with gcc but AC with clang. O(n lg n).
Solved with O(nlogn) suffix array and O(nlogn) post-processing, but only using clang compiler, got TLE with gcc...Last edit: 2020-08-25 21:03:38
AC with O(n) Suffix Array. Time limit is so strict. Any extra log factor while traversing the LCP array gives TLE. I've used a deque while traversing the LCP array for finding the ans.
time limit is bullshit, comon, increase it someLast edit: 2018-07-29 10:26:45
Can I use "while(scanf("%s",ch))!=EOF)" for input?
WA on #10, because I forget to update information on the parent treeLast edit: 2018-06-04 05:26:37
Last edit: 2018-04-13 11:13:29
[Removed] Nevermind...Last edit: 2018-01-05 09:15:51
never mind, submitted, passed until 10 and TLE