Increasing diagonals X17276


Statement
 

pdf   zip

html

Given a rectangular matrix n × m, and an initial position in the matrix, determine whether the four diagonals starting at the initial position have elements in strictly increasing order or not.

Input

The input is formed by several cases. Each case starts with the number of rows n and the number of columns m, followed by n lines with m integers each. The case ends with the row and colummn of the initial position (starting at 0).

Output

For each case, write “yes” or “no” accordingly.

Your program should follow a right programming style. Please, include the appropriate comments.

Public test cases
  • Input

    5 6
    0 7 0 0 0 3
    0 0 4 0 2 0
    0 0 0 1 0 0
    0 0 8 0 3 0
    0 9 0 0 0 8
    2 3
    
    5 6
    0 7 0 0 0 3
    0 0 4 0 2 0
    0 0 0 1 0 0
    0 0 8 0 1 0
    0 9 0 0 0 8
    2 3
    
    13 7
     498 -572  -19  -14  577 -497   91
    -598 -786  -16  -42  638  -34  585
     341  503 -260  923    3 -598 -934
     155   61 -396  -17 -955  226  442
    -252 -173 -700 -279 -716  908  441
     867  312 -391 -476  -38 -978  454
     359  492 -740 -985  304 -562  780
    -597  632 -252 -595 -992 -907  425
    -764  519   12  114  683 -300 -591
     982  282  485  926   -9  310 -633
    -791 -806  445  661 -402  747  699
    -723 -846  653  851  -53  411   34
    -394 -373 -638 -648   86 -510 -370
    11 6
    
    
    
    

    Output

    yes
    no
    no
    
  • Input

    2 2
    -1 2
    -4 5
    0 0
    
    2 2
    -1 2
    -4 5
    0 1
    
    1 1
    -1000000
    0 0
    
    
    

    Output

    yes
    no
    yes
    
  • Information
    Author
    Amalia Duch
    Language
    English
    Translator
    Maria Serna
    Original language
    Catalan
    Other languages
    Catalan Spanish
    Official solutions
    Unknown. This problem is being checked.
    User solutions
    C++