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

建议使用的浏览器:

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

3935:Dark Room

题目描述
One day Harry Potter came to a magic room, in which there are some shadow monsters sent by the black wizard waiting for him. Fortunately, shadow monsters can only live in areas where there are no lights shining, there are n*m lamps on the roof of the room, every little lamp can only illuminate the scope of the fixed area, and all the area of lights shining don't overlap, some lamps on, some lamps off, the areas below the closed lamps will appear the shadow, and in these areas shadow monsters will attack Harry Potter. Now Harry Potter comes to you and gives you the previous state of the room lights, Harry Potter can control the light switch in a remote place .The state of a light will change as follows: if a lamp state changed, the state of the lights which before it, after it, left to it or right to it will all change. Your task is to calculate how many times we need at least to turn on all the lights by changing the state of the lamps.
输入解释
in the first line there are two integers, n (1 < = n < = 100) and m (1 < = m < = 15), stands for there are n lines, each line have m data, 0 stands for the lights off, 1 stands for the lights on.
输出解释
for each group of input data, output an integer stands for the minimum number we need to change the state of the lights to put all the lights on, if we can't turn on all the lamps, output 'no solution'.
输入样例
3 3
1 0 1
0 0 0
1 0 1
输出样例
1
来自杭电HDUOJ的附加信息
Recommend

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

源链接: HDU-3935

最后修改于 2020-10-25T23:08:27+00:00 由爬虫自动更新

共提交 0

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