Saratov State University :: Online Contester

::Go
- home
- news
- register
 - update personal info
 - problemset archive
- submit
- status online
- standing
- contests
- virtual contests
- forum
- statistic
- FAQ
- projects

 ::Poll Are you registered on Codeforces?YesNoWhat is it???[results]

::webboard

 time limit on twst 10
Author: guguli
ID: 049831
Problem: 168
Contest: 0
Date: 2012-08-15 18:14:18

why time limit on test 10?
it is my code :

#include <iostream>
using namespace std;
const int maxn=1005;
int d2[maxn][maxn],d1[maxn][maxn];
int main()
{
int n,m;
cin>>n>>m;
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
cin>>d1[i][j];
for(int i=n;i>0;i--)
for(int j=1;j<=m;j++)
{
if(i==n)
d2[i][j]=d1[i][j];
else
d2[i][j]=min(d1[i][j],d2[i+1][j]);
}
for(int j=m;j>0;j--)
for(int i=1;i<=n;i++)
{
if(j==m)
d1[i][j]=d2[i][j];
if(j!=m && i==1)
d1[i][j]=min(d1[i][j+1],d2[i][j]);
if(j!=m && i!=1)
d1[i][j]=min(d1[i-1][j+1],d2[i][j]);
}
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
cout<<d1[i][j]<<" ";
cout<<endl;
}

return 0;
}