Help needed CHEFARC

Problem :
Hello coders!! I just tried this problem got 25/100

My Solution

My Approach :

Build grid1 using bfs to reach to the max point from (0,0)
Build grid2 using bfs to reach max point from (0,m-1)

find every element indexed of grid1 and grid2 such that neither of grid1 and grid2 is maximum and store it in final grid

return minium of final grid

Can someone please tell me where my approach lacks?

Check the editorial if you’re not sure of your approach.