답안 #7576

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
7576 2014-08-11T12:44:54 Z dohyun0324 배열 탈출 (GA8_array) C++
0 / 100
0 ms 49908 KB
#include<stdio.h>
int n,a[2500][2500],d[2500][2500];
int mini(int x,int y)
{
    if(x<y) return x;
    return y;
}
int f(int x)
{
    if(x>0) return x;
    return 0;
}
int main()
{
    int i,j;
    freopen("input.txt","r",stdin);
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=n;j++)
        {
            scanf("%d",&a[i][j]);
        }
    }
    for(i=0;i<=n;i++)
    {
        for(j=0;j<=n;j++)
        {
            if(i==0 || j==0) d[i][j]=2100000000;
        }
    }
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=n;j++)
        {
            if(i==1 && j==1) continue;
            d[i][j]=mini(d[i-1][j]+f(a[i][j]-a[i-1][j]+1),d[i][j-1]+f(a[i][j]-a[i][j-1]+1));
        }
    }
    printf("%d",d[n][n]);
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 49908 KB open (syscall #2) was called by the program (disallowed syscall)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 49908 KB open (syscall #2) was called by the program (disallowed syscall)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 49908 KB open (syscall #2) was called by the program (disallowed syscall)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 49908 KB open (syscall #2) was called by the program (disallowed syscall)
2 Halted 0 ms 0 KB -