{"trustable":false,"sections":[{"title":"Description","value":{"format":"HTML","content":"\n \u003cpre\u003e小铭学姐是一个吸血鬼,家里有个大豪斯,不对,是大城堡!小铭学姐都住不同的房间。现在她有个问题,她的城堡有多少个房间,最大的房间有多大?\n\u003cbr\u003e 1 2 3 4 5 6 7 \u003cbr\u003e #############################\u003cbr\u003e 1 # | # | # | | #\u003cbr\u003e #####---#####---#---#####---#\u003cbr\u003e 2 # # | # # # # #\u003cbr\u003e #---#####---#####---#####---#\u003cbr\u003e 3 # | | # # # # #\u003cbr\u003e #---#########---#####---#---#\u003cbr\u003e 4 # # | | | | # #\u003cbr\u003e #############################\u003cbr\u003e (图 1)\u003cbr\u003e\u003cbr\u003e # \u003d Wall \u003cbr\u003e | \u003d No wall\u003cbr\u003e - \u003d No wall\u003cbr\u003e\u003c/pre\u003e\n \u003cbr\u003e图1是一个城堡的地形图。请你编写一个程序,计算城堡一共有多少房间,最大的房间有多大。城堡被分割成mn(m≤50,n≤50)个方块,每个方块可以有0~4面墙。\n \u003cbr\u003e\n "}},{"title":"Input","value":{"format":"HTML","content":"\n第一行是两个整数,分别是南北向、东西向的房间数。在之后的输入里,每个房间用一个数字(0≤p≤50)描述。用一个数字表示房间周围的墙,1表示西墙,2表示北墙,4表示东墙,8表示南墙。每个房间用代表其周围墙的数字之和表示。城堡的内墙被计算两次,方块(1,1)的南墙同时也是方块(2,1)的北墙。输入的数据保证城堡至少有两个房间。\n "}},{"title":"Output","value":{"format":"HTML","content":"\n城堡的房间数、城堡中最大房间所包括的方块数。\n "}},{"title":"Sample Input1","value":{"format":"HTML","content":"\u003cpre\u003e2\n2\n7 14\n15 15\u003c/pre\u003e"}},{"title":"Sample Output1","value":{"format":"HTML","content":"\u003cpre\u003e3\n2\u003c/pre\u003e"}},{"title":"Sample Input2","value":{"format":"HTML","content":"\n\u003cpre\u003e4 \n7 \n11 6 11 6 3 10 6 \n7 9 6 13 5 15 5 \n1 10 12 7 13 7 5 \n13 11 10 8 10 12 13 \u003c/pre\u003e\n "}},{"title":"Sample Output2","value":{"format":"HTML","content":"\u003cpre\u003e5\n9\u003c/pre\u003e\n "}}]}