QOJ.ac

QOJ

时间限制: 2500 s 内存限制: 524288 MB 总分: 100 可 Hack ✓

#14030. 回文

统计

小 Vitechka 非常喜欢回文。在他的生日那天,小 Mitechka 送给他一个由 $m$ 行 $n$ 列小写英文字母组成的表格。但 Mitechka 不知道的是,Vitechka 只有在表格中至少有一行是回文时才会喜欢这个表格。现在 Mitechka 想要沿着列将他的表格切成若干个子表格,使得 Vitechka 喜欢所有切分出来的子表格。Mitechka 想要最小化切分出的子表格数量。请帮助他找到这个最小值。

输入格式

第一行包含两个整数 $m$ 和 $n$($1 \le m \le 10$,$1 \le n \le 10^5$)。

接下来的 $m$ 行包含表格的描述。其中每行包含一个由 $n$ 个小写英文字母组成的字符串。

输出格式

输出一个整数:问题的答案。

样例

输入样例 1

2 11
xyaaabaaaxy
aaaaxyzaaba

输出样例 1

3

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.