Table for P1 's journey from  start to meeting cell
for ( int i = 1 ; i <= N ; i ++ ) for ( int j = 1 ; j <= M ; j ++ ) P1S [ i , j ] = Math . Max ( P1S [ i - 1 , j ] , P1S [ i , j - 1 ] ) + A [ i - 1 , j - 1 ] ;