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

建议使用的浏览器:

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

2004:Mix and Build

Special Judge 特殊评判
题目描述
In this problem, you are given a list of words (sequence of lower case letters). From this list, find the longest chain of words w1, ..., wn such that wi is a mixed extension of wi-1. A word A is a mixed extension of another word B if A can be formed by adding one letter to B and permuting the result. For example, "ab", "bar", "crab", "cobra", and "carbon" form a chain of length 5.
输入解释
The input contains at least two, but no more than 10000 lines. Each line contains a word. The length of each word is at least 1 and no more than 20. All words in the input are distinct.
输出解释
Write the longest chain that can be constructed from the given words. Output each word in the chain on a separate line, starting from the first one. If there are multiple longest chains, any longest chain is acceptable.
输入样例
ab
arc
arco
bar
bran
carbon
carbons
cobra
crab
crayon
narc
输出样例
ab
bar
crab
cobra
carbon
carbons
来自北京大学POJ的附加信息
Case time limit(单组数据时间限制) 2000MS

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 Rocky Mountain 2004

源链接: POJ-2004

最后修改于 2020-10-29T06:20:14+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
5000 65536