#P1893. J-CardinalAdjacencies

J-CardinalAdjacencies

题目描述

Click here to read PDF of this problem

输入格式

As shown in the PDF.

输出格式

As shown in the PDF

样例

5 5 
1 0 0 1 0 
0 1 1 0 1 
0 1 0 1 1 
1 0 1 1 1 
0 1 1 1 1
14 31

提示

By 秦浩源