给几个数据,求助的可以来看一下,应该注意的点都在里面了吧...

P1162 填涂颜色

WHH_FZZ @ 2022-08-09 22:37:15

第一组
输入:
6
0 0 0 0 0 0
0 0 1 1 1 1
0 1 1 0 0 1
1 1 0 0 0 1
1 0 0 0 0 1
1 1 1 1 1 1
输出:
0 0 0 0 0 0
0 0 1 1 1 1
0 1 1 2 2 1
1 1 2 2 2 1
1 2 2 2 2 1
1 1 1 1 1 1
这个是样例...(好像是废话...)

第二组(#2 / #6)
输入:
5
0 0 0 1 0
0 0 1 1 0
0 1 0 0 0
1 0 0 0 0
1 1 1 1 1
输出:
0 0 0 1 0 
0 0 1 1 0 
0 1 0 0 0 
1 0 0 0 0 
1 1 1 1 1 
(1. 环不一定存在; 2. 注意第二行和第三行, 1是斜着爬的.... )

第三组 (#3)
输入:
6
0 0 1 1 1 0
1 1 1 0 1 0
1 0 0 0 0 1
1 1 0 1 1 1
0 1 0 1 0 0
0 1 1 1 0 0
输出:
0 0 1 1 1 0
1 1 1 2 1 0
1 2 2 2 2 1
1 1 2 1 1 1
0 1 2 1 0 0
0 1 1 1 0 0

第四组(#4)
输入:
20
0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0
0 0 0 0 1 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0
0 0 0 0 1 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0
0 0 0 0 1 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0
0 0 0 0 1 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0
0 0 0 0 1 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0
1 1 1 1 1 0 1 1 1 1 1 1 0 1 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 0 1 1 1
0 0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 0 0 0 0 1 2 1 0 0 1 2 1 1 1 1 1 
0 0 0 0 0 0 0 0 1 2 1 0 0 1 2 1 0 0 0 0 
0 0 0 0 0 0 0 0 1 2 1 0 0 1 2 1 0 0 0 0 
0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 1 0 0 0 0 

第五组(#6)
输入:
4
1 1 1 1
1 0 0 1
1 0 0 0
1 1 1 1
输出:
1 1 1 1
1 0 0 1
1 0 0 0
1 1 1 1

第六组(好像测试点里没有,不确定是否符合题意,参考一下....)
输入:
8
0 0 0 0 0 0 0 0 
0 1 1 0 0 1 1 0 
1 0 0 1 1 0 0 1 
1 0 0 1 0 0 0 1 
1 1 1 1 1 0 0 1
0 1 0 0 1 1 1 0
0 1 0 0 0 0 1 0
0 1 0 0 0 0 1 0
输出:
0 0 0 0 0 0 0 0
0 1 1 0 0 1 1 0
1 2 2 1 1 2 2 1
1 2 2 1 2 2 2 1
1 1 1 1 1 2 2 1
0 1 0 0 1 1 1 0
0 1 0 0 0 0 1 0
0 1 0 0 0 0 1 0

by hhhyh @ 2022-11-15 23:51:42

感谢,忘记环可以不在了


|