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

建议使用的浏览器:

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

3059:Count Cross

题目描述
Given a MM×NN grid with different colors(black and white) on each cell, your task is to calculate the total amount of crosses of black color. We say there exists a black cross centered at the black cell (x,y) if there are four positive integer L,R,U,D that the cell(x,y-L),(x,y+R),(x-U,y),(x+D,y) are all black. Note that if two crosses have the same center but different L,R,U,D, we consider they are distinct.We use 1 to describe black.

For example

00100
00100
11111
00100
00100
00000

There are 16 black crosses.

The MM and NN are large, so we divide the matrix into M×N rectangle blocks.If two cells are in the same block ,their colors are same.

So we can divide the sample into 4×3 blocks.
输入解释
There are at most 100 cases.

In every case,there are two integers, M, N in the first line. (1≤M, N≤50)

The next line contains M positive integers which are less than or equals to 50. The p-th integer describe the p-th row block's height.

The next line contains N positive integers which are less than or equals to 50. The p-th integer describe the p-th colomn block's width.

The following M lines each has a string which contain N digits.The q-th digit in the p-th line describe the color of the q-th colomn block in the p-th row.
输出解释
Output the answer to each case.
输入样例
4 3
2 1 2 1
2 1 2
010
111
010
000 
输出样例
16
来自杭电HDUOJ的附加信息
Recommend gaojie

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3059

最后修改于 2020-10-25T22:59:39+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 65535/65535K(Java/Others)