• 应用
• 登录
• 注册

SP1811 LCS - Longest Common Substring

• 94通过
• 216提交
• 题目来源
• 评测方式 RemoteJudge
• 标签 后缀数组,SA 字符串 构造
• 难度 省选/NOI-
• 时空限制 294ms / 1536MB
• 提示：收藏到任务计划后，可在首页查看。

题意翻译

输入2 个长度不大于250000的字符串，输出这2 个字符串的最长公共子串。如果没有公共子串则输出0 。

Translated by @xyz32768

题目描述

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 simple, for two given strings, find the length of the longest common substring of them.

Here common substring means a substring of two or more strings.

输入输出格式

输入格式：

The input contains exactly two lines, each line consists of no more than 250000 lowercase letters, representing a string.

输出格式：

The length of the longest common substring. If such string doesn't exist, print "0" instead.

输入输出样例

输入样例#1： 复制
alsdfkjfjkdsal
fdjskalajfkdsla
输出样例#1： 复制
3
提示
标程仅供做题后或实在无思路时参考。
请自觉、自律地使用该功能并请对自己的学习负责。
如果发现恶意抄袭标程，将按照I类违反进行处理。