# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
7498 |
2014-08-09T12:18:49 Z |
baneling100 |
배열 탈출 (GA8_array) |
C++ |
|
0 ms |
39696 KB |
#include <stdio.h>
int N, A[2223][2223], D[2223][2223];
void input(void)
{
int i, j;
scanf("%D",&N);
for(i=1 ; i<=N ; i++)
for(j=1 ; j<=N ; j++)
scanf("%d",&A[i][j]);
}
int Dist(int X, int Y)
{
if(X>Y)
return 0;
return Y-X+1;
}
int MIN(int X, int Y)
{
if(X<Y)
return X;
return Y;
}
void process(void)
{
int i, j;
D[1][1]=0;
for(i=2 ; i<=N ; i++)
{
D[1][i]=D[1][i-1]+Dist(A[1][i-1],A[1][i]);
D[i][1]=D[i-1][1]+Dist(A[i-1][1],A[i][1]);
}
for(i=2 ; i<=N ; i++)
for(j=2 ; j<=N ; j++)
D[i][j]=MIN(D[i][j-1]+Dist(A[i][j-1],A[i][j]),D[i-1][j]+Dist(A[i-1][j],A[i][j]));
}
void output(void)
{
printf("%d",D[N][N]);
}
int main(void)
{
input();
process();
output();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
39696 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
39696 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
39696 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
39696 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |