답안 #7342

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
7342 2014-08-02T00:35:05 Z myungwoo 배열 탈출 (GA8_array) C++
100 / 100
660 ms 39728 KB
#include <stdio.h>

#define MAXN 2224

int N,A[MAXN][MAXN],D[MAXN][MAXN];

int main()
{
	int i,j,k,s;
	scanf("%d",&N);
	for (i=1;i<=N;i++) for (j=1;j<=N;j++) scanf("%d",A[i]+j), D[i][j] = 2e9;
	D[1][1] = 0;
	for (i=1;i<=N;i++) for (j=1;j<=N;j++){
		if (i < N){
			int v = A[i][j] <= A[i+1][j] ? A[i+1][j]-A[i][j]+1 : 0;
			if (D[i+1][j] > D[i][j]+v) D[i+1][j] = D[i][j]+v;
		}
		if (j < N){
			int v = A[i][j] <= A[i][j+1] ? A[i][j+1]-A[i][j]+1 : 0;
			if (D[i][j+1] > D[i][j]+v) D[i][j+1] = D[i][j]+v;
		}
	}
	printf("%d\n",D[N][N]);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 39728 KB Output is correct
2 Correct 0 ms 39728 KB Output is correct
3 Correct 0 ms 39728 KB Output is correct
4 Correct 0 ms 39728 KB Output is correct
5 Correct 0 ms 39728 KB Output is correct
6 Correct 0 ms 39728 KB Output is correct
7 Correct 0 ms 39728 KB Output is correct
8 Correct 0 ms 39728 KB Output is correct
9 Correct 0 ms 39728 KB Output is correct
10 Correct 0 ms 39728 KB Output is correct
11 Correct 0 ms 39728 KB Output is correct
12 Correct 0 ms 39728 KB Output is correct
13 Correct 0 ms 39728 KB Output is correct
14 Correct 0 ms 39728 KB Output is correct
15 Correct 0 ms 39728 KB Output is correct
16 Correct 0 ms 39728 KB Output is correct
17 Correct 0 ms 39728 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 39728 KB Output is correct
2 Correct 0 ms 39728 KB Output is correct
3 Correct 0 ms 39728 KB Output is correct
4 Correct 0 ms 39728 KB Output is correct
5 Correct 0 ms 39728 KB Output is correct
6 Correct 0 ms 39728 KB Output is correct
7 Correct 0 ms 39728 KB Output is correct
8 Correct 0 ms 39728 KB Output is correct
9 Correct 0 ms 39728 KB Output is correct
10 Correct 0 ms 39728 KB Output is correct
11 Correct 0 ms 39728 KB Output is correct
12 Correct 0 ms 39728 KB Output is correct
13 Correct 0 ms 39728 KB Output is correct
14 Correct 0 ms 39728 KB Output is correct
15 Correct 0 ms 39728 KB Output is correct
16 Correct 0 ms 39728 KB Output is correct
17 Correct 0 ms 39728 KB Output is correct
18 Correct 0 ms 39728 KB Output is correct
19 Correct 0 ms 39728 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 39728 KB Output is correct
2 Correct 4 ms 39728 KB Output is correct
3 Correct 0 ms 39728 KB Output is correct
4 Correct 8 ms 39728 KB Output is correct
5 Correct 0 ms 39728 KB Output is correct
6 Correct 8 ms 39728 KB Output is correct
7 Correct 4 ms 39728 KB Output is correct
8 Correct 8 ms 39728 KB Output is correct
9 Correct 4 ms 39728 KB Output is correct
10 Correct 8 ms 39728 KB Output is correct
11 Correct 8 ms 39728 KB Output is correct
12 Correct 8 ms 39728 KB Output is correct
13 Correct 4 ms 39728 KB Output is correct
14 Correct 8 ms 39728 KB Output is correct
15 Correct 4 ms 39728 KB Output is correct
16 Correct 4 ms 39728 KB Output is correct
17 Correct 4 ms 39728 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 656 ms 39728 KB Output is correct
2 Correct 660 ms 39728 KB Output is correct
3 Correct 640 ms 39728 KB Output is correct
4 Correct 652 ms 39728 KB Output is correct
5 Correct 528 ms 39728 KB Output is correct
6 Correct 600 ms 39728 KB Output is correct
7 Correct 652 ms 39728 KB Output is correct
8 Correct 652 ms 39728 KB Output is correct
9 Correct 652 ms 39728 KB Output is correct
10 Correct 576 ms 39728 KB Output is correct
11 Correct 564 ms 39728 KB Output is correct
12 Correct 524 ms 39728 KB Output is correct
13 Correct 472 ms 39728 KB Output is correct
14 Correct 568 ms 39728 KB Output is correct
15 Correct 452 ms 39728 KB Output is correct
16 Correct 560 ms 39728 KB Output is correct
17 Correct 556 ms 39728 KB Output is correct
18 Correct 524 ms 39728 KB Output is correct
19 Correct 572 ms 39728 KB Output is correct
20 Correct 572 ms 39728 KB Output is correct
21 Correct 520 ms 39728 KB Output is correct