当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5510:Bazinga

题目描述
Ladies and gentlemen, please sit up straight.
Don't tilt your head. I'm serious.

For $n$ given strings $S_1,S_2,\cdots,S_n$, labelled from $1$ to $n$, you should find the largest $i~(1\le i\le n)$ such that there exists an integer $j~(1\le j<i)$ and $S_j$ is not a substring of $S_i$.

A substring of a string $S_i$ is another string that occurs in $S_i$. For example, ``ruiz" is a substring of ``ruizhang", and ``rzhang" is not a substring of ``ruizhang".
输入解释
The first line contains an integer $t~(1\le t\le 50)$ which is the number of test cases.
For each test case, the first line is the positive integer $n~(1\le n\le 500)$ and in the following $n$ lines list are the strings $S_1,S_2,\cdots,S_n$.
All strings are given in lower-case letters and strings are no longer than $2000$ letters.
输出解释
For each test case, output the largest label you get. If it does not exist, output $-1$.
输入样例
4
5
ab
abc
zabc
abcd
zabcd
4
you
lovinyou
aboutlovinyou
allaboutlovinyou
5
de
def
abcd
abcde
abcdef
3
a
ba
ccc
输出样例
Case #1: 4
Case #2: -1
Case #3: 4
Case #4: 3
来自杭电HDUOJ的附加信息
Recommend wange2014

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5510

最后修改于 2020-10-25T23:23:17+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 65536/65536K(Java/Others)