# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
7728 |
2014-08-17T02:56:39 Z |
ggoh |
배열 탈출 (GA8_array) |
C++ |
|
0 ms |
65536 KB |
#include<cstdio>
int a,i,j,x,y,z[3333][3333],D[3333][3333];
int min(int A,int B)
{
if(A>B)return B;
else return A;
}
main()
{
scanf("%d",&a);
for(i=1;i<=a;i++)
{
for(j=1;j<=a;j++)
{
scanf("%d",&z[i][j]);
}
}
for(i=2;i<=a;i++)
{
if(z[i][1]>=z[i-1][1])
{
D[i][1]=D[i-1][1]+z[i][1]-z[i-1][1]+1;
}
else
{
D[i][1]=D[i-1][1];
}
if(z[1][i]>=z[1][i-1])
{
D[1][i]=D[1][i-1]+z[1][i]-z[1][i-1]+1;
}
else
{
D[1][i]=D[1][i-1];
}
}
for(i=2;i<=a;i++)
{
for(j=2;j<=a;j++)
{
if(z[i][j]>=z[i][j-1])
{
x=z[i][j]-z[i][j-1]+1;
}
else x=0;
if(z[i][j]>=z[i-1][j])
{
y=z[i][j]-z[i-1][j]+1;
}
else y=0;
D[i][j]=min(D[i][j-1]+x,D[i-1][j]+y);
}
}
printf("%d",D[a][a]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Memory limit exceeded |
0 ms |
65536 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Memory limit exceeded |
0 ms |
65536 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Memory limit exceeded |
0 ms |
65536 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Memory limit exceeded |
0 ms |
65536 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |