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

建议使用的浏览器:

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

2518:Little guys' game

题目描述
Here is game played by little guys. There is a 4 * 4 square, and the square is filled with the characters 'A', 'B', 'C' and 'D'. Each kind of character appears exactly 4 times. You can arbitrarily swap two adjacent characters (horizontal or vertical). At the beginning of the game you should choose a character (from 'A', 'B', 'C' and 'D') as you target character, when any 2 * 2 sub-square contains the same character as the character you have chosen before, you win the game.

These little guys want to use minimal times of swap to win the game. Now they turn to you. Can you help them?
输入解释
There are multiple test cases. Each contains a 4 * 4 square as the initial situation. Notice that the square only contains 'A', 'B', 'C' and 'D', and each kind of characters will appear exactly 4 times.
输出解释
You should output the minimal swap times to win the game, and you should also output how many kinds of strategies you can achieve the minimal swap times.

You should pay attention that if two strategies swap the characters in the same order but with the different target characters, these two strategies are still considered as different.
输入样例
AABB
ABAB
CDCD
CCDD

ACAB
CBBD
ADAD
DCBC
输出样例
1 4
4 96

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

源链接: POJ-2518

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

共提交 0

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