답안 #7838

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
7838 2014-08-19T11:12:18 Z comet 배열 탈출 (GA8_array) C++
49 / 100
1000 ms 39812 KB
#include<cstdio>
#include<algorithm>
#include<memory.h>
#define INF 987654321
using namespace std;
int n;
int a[2222][2222];
int d[2222][2222];
int f(int x,int y){
    if(x>=n||y>=n)return INF;
    if(x==n-1&&y==n-1)return 0;
    int& ret=d[x][y];
    if(ret!=-1)return ret;
    ret=min(f(x+1,y)+max(a[x+1][y]-a[x][y]+1,0),f(x,y+1)+max(a[x][y+1]-a[x][y]+1,0));
    return ret;
}
int main(){
    scanf("%d",&n);
    memset(d,-1,sizeof(d));
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            scanf("%d",&a[i][j]);
    printf("%d",f(0,0));
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 39660 KB Output is correct
2 Correct 4 ms 39660 KB Output is correct
3 Correct 12 ms 39660 KB Output is correct
4 Correct 8 ms 39660 KB Output is correct
5 Correct 0 ms 39660 KB Output is correct
6 Correct 4 ms 39660 KB Output is correct
7 Correct 8 ms 39660 KB Output is correct
8 Correct 8 ms 39660 KB Output is correct
9 Correct 8 ms 39660 KB Output is correct
10 Correct 4 ms 39660 KB Output is correct
11 Correct 0 ms 39660 KB Output is correct
12 Correct 4 ms 39660 KB Output is correct
13 Correct 8 ms 39660 KB Output is correct
14 Correct 4 ms 39660 KB Output is correct
15 Correct 4 ms 39660 KB Output is correct
16 Correct 4 ms 39660 KB Output is correct
17 Correct 4 ms 39660 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 39660 KB Output is correct
2 Correct 4 ms 39660 KB Output is correct
3 Correct 4 ms 39660 KB Output is correct
4 Correct 0 ms 39660 KB Output is correct
5 Correct 8 ms 39660 KB Output is correct
6 Correct 8 ms 39660 KB Output is correct
7 Correct 12 ms 39660 KB Output is correct
8 Correct 4 ms 39660 KB Output is correct
9 Correct 0 ms 39660 KB Output is correct
10 Correct 4 ms 39660 KB Output is correct
11 Correct 8 ms 39660 KB Output is correct
12 Correct 4 ms 39660 KB Output is correct
13 Correct 0 ms 39660 KB Output is correct
14 Correct 12 ms 39660 KB Output is correct
15 Correct 4 ms 39660 KB Output is correct
16 Correct 8 ms 39660 KB Output is correct
17 Correct 4 ms 39660 KB Output is correct
18 Correct 0 ms 39660 KB Output is correct
19 Correct 0 ms 39660 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 39660 KB Output is correct
2 Correct 8 ms 39660 KB Output is correct
3 Correct 12 ms 39660 KB Output is correct
4 Correct 16 ms 39660 KB Output is correct
5 Correct 8 ms 39660 KB Output is correct
6 Correct 4 ms 39660 KB Output is correct
7 Correct 16 ms 39660 KB Output is correct
8 Correct 0 ms 39660 KB Output is correct
9 Correct 8 ms 39660 KB Output is correct
10 Correct 4 ms 39660 KB Output is correct
11 Correct 16 ms 39660 KB Output is correct
12 Correct 8 ms 39660 KB Output is correct
13 Correct 12 ms 39660 KB Output is correct
14 Correct 12 ms 39660 KB Output is correct
15 Correct 8 ms 39660 KB Output is correct
16 Correct 12 ms 39660 KB Output is correct
17 Correct 12 ms 39660 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1000 ms 39812 KB Output is correct
2 Incorrect 964 ms 39812 KB Output isn't correct
3 Halted 0 ms 0 KB -