#include #include #include #include using namespace std; ifstream f("run.in"); ofstream g("run.out"); int di[]={1,0}; //initializare pentru avansare int dj[]={0,1}; int ok(int i,int j,int n,int m) { if(i>0&&i<=n&&j>0&&j<=m) return 1; //verificam daca am iesit din matrice return 0; } int main() { long n,m,i,j,a[101][101],q[1000][2],nq,pq,k,ni,nj,l; char c[101][101]; memset (a,-1,sizeof(a)); f>>n>>m; for(i=1;i<=n;i++) for(j=1;j<=m;j++) f>>c[i][j]; q[0][0]=1; q[0][1]=1; a[1][1]=0; pq=0; nq=1; while(pqa[i][j]+1)) { l=max(a[ni+1][nj],a[ni][nj+1]); a[ni][nj]=max(a[i][j]+1,l); q[nq][0]=ni; q[nq][1]=nj; nq++; } } pq++;} int maxi=0; for(i=1;i<=n;i++) for(j=1;j<=m;j++) if(a[i][j]>maxi) maxi=a[i][j]; g<