21618_ZeroPuzzling

2022-5-16 18:19| 发布者: Hocassian| 查看: 27| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505694666600-Problem List-采集的数据-后羿采集器.html

Pro.ID

21618

Title

Zero Puzzling

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21618

AC

4

Submit

7

Ratio

57.14%

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    There is a matrix with m rows and n columns. An element of the matrix has at most four adjacent elements (up, down, left, right). You can add a same number to a pair of adjacent elements of the matrix. By doing this operation repeatedly, can you make the matrix zero?

    输入

    A line contains m and n indicating the rows and columns of the matrix. ( 0 < m, n < 5 )

    Each of the following m lines contains n integers ( -106 ≤ each integer ≤ 106 ).

    Input is terminated by one line contains two zeros.

    输出

    Description

    There is a matrix with m rows and n columns. An element of the matrix has at most four adjacent elements (up, down, left, right). You can add a same number to a pair of adjacent elements of the matrix. By doing this operation repeatedly, can you make the matrix zero?

    Input

    A line contains m and n indicating the rows and columns of the matrix. ( 0 < m, n < 5 )

    Each of the following m lines contains n integers ( -106 ≤ each integer ≤ 106 ).

    Input is terminated by one line contains two zeros.

    Output

    If the matrix can be converted into zero, output "Yes" on a line otherwise output "No" on a line.

    Sample Input

    2 2
    1 1
    1 0

    2 2
    0 0
    1 1

    0 0

    Sample Output

    No
    Yes

    Source

    样例输入

    2 2
    1 1
    1 0

    2 2
    0 0
    1 1

    0 0

    样例输出

    No
    Yes

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部