Responsive image

问题 1834 --Rikka with String

1834: Rikka with String

时间限制: 6 Sec  内存限制: 128 MB
提交: 1  解决: 1
[提交][状态][讨论版][命题人:]

题目描述

As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them:
Yuta has 01 strings si, and he wants to know the number of 01 antisymmetric strings of length 2L which contain all given strings si as continuous substrings.
01 string s is antisymmetric if and only if s[i]≠s[|s|−i+1] for all i∈[1,|s|].
It is too difficult for Rikka. Can you help her?
In the second sample, the strings which satisfy all the restrictions are 000111,001011,011001,100110.
 

输入描述

The first line contains a number t(1≤t≤5), the number of the testcases. 

For each testcase, the first line contains two numbers n,L(1≤n≤6,1≤L≤100)

Then n lines follow, each line contains a 01 string si(1≤|si|≤20).

输出描述

For each testcase, print a single line with a single number -- the answer modulo 998244353.

样例输入

2
2 2
011
001
2 3
011
001

样例输出

1
4

来源

 

[提交][状态]
ACM算法攻关部
  • Anything about this OnlineJudge, Please Contact Administrator. Click add QQ

    OJ system based on HUSTOJ Project , UI based on Twitter Bootstrap

    Copyright 2016 ACM算法攻关部
    关于网站改版