A1395 | [COCI-2020-2021-contest6]#2 Anagramistica
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
Biljana loves making crosswords. Her favourite type is the so called anagram crossword, where each clue is an anagram of the required solution.
She has a set of n words that she thinks would be good candidates for her next puzzle. We say that two words are similar if one can be obtained from the other by rearranging the letters (i.e. they are anagrams).
She wants to select a subset of her words, such that there are exactly k pairs of similar words in that subset. Help Biljana determine the number of such subsets.
She has a set of n words that she thinks would be good candidates for her next puzzle. We say that two words are similar if one can be obtained from the other by rearranging the letters (i.e. they are anagrams).
She wants to select a subset of her words, such that there are exactly k pairs of similar words in that subset. Help Biljana determine the number of such subsets.
输入格式
The first line contains integers n (1 ≤ n ≤ 2000) and k (0 ≤ k ≤ 2000), the number of words and the required number of similar pairs.
Each of the following n lines contains a word consisting of at most 10 lowercase letters. All words will be distinct.
Each of the following n lines contains a word consisting of at most 10 lowercase letters. All words will be distinct.
输出格式
Output the number of described subsets modulo 10^9 +
7.
7.
输入输出样例
输入 #1
3 1 ovo ono voo
输出 #1
3
输入 #2
5 2 trava vatra vrata leo ole
输出 #2
3
Subtask Points Constraints
1 10 1 ≤ n ≤ 15
2 30 0 ≤ k ≤ 3
3 70 No additional constraints.
Clarification of the first example:
Subsets with exactly one similar pair are {ovo, ono, voo} and {ovo, voo}.
1 10 1 ≤ n ≤ 15
2 30 0 ≤ k ≤ 3
3 70 No additional constraints.
Clarification of the first example:
Subsets with exactly one similar pair are {ovo, ono, voo} and {ovo, voo}.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted