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

建议使用的浏览器:

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

3867:Funny Language

Special Judge 特殊评判
题目描述
There is a well know game with words. Given a word you have to write as many other words as possible using the letters from the given word. If the letter repeats multiple times in the original word, you can use it up to as many times in the new words. The order of letters in the original word does not matter. For example, given the word CONTEST you can write NOTE, NET, ON, TEST, SET, etc.
Now you are in charge of writing a new dictionary. Your task is to sneak n new words into it. You know in advance m words Wi (1 <= i <= m) that you will have to play a game with and you need to figure out which new n words to add to the dictionary to maximize the total number of words you can write out of these m words.
More formally, find such a set of nonempty words S where |S| = n, Wi __poj_jax_start__\notin__poj_jax_end__\notin S for any i, and __poj_jax_start__\sum\limits_{i = 1}^m {|S_i|}__poj_jax_end__\sum\limits_{i = 1}^m {|S_i|} is maximal, where Si __poj_jax_start__\subset__poj_jax_end__\subset S is the set of words that can be written using letters from Wi.
输入解释
The first line of the input file contains two integer numbers n (1 <= n <= 100) - the number of new words you can add to the dictionary and m (1 <= m <= 1 000) - the number of words you will play the game with. The following m lines contain original words. Each word consists of at most 100 uppercase letters from A to Z.
输出解释
Write to the output file n lines with a new word on a line.
输入样例
3 5
A
ACM
ICPC
CONTEST
NEERC
输出样例
C
CN
E

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

源链接: POJ-3867

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

共提交 0

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