답안 #7603

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
7603 2014-08-12T10:49:18 Z gs13031 배열 탈출 (GA8_array) C++
6 / 100
680 ms 39936 KB
#include<stdio.h>
int n, a[2230][2230], dp[2230][2230];
int main()
{
	int i, j, x, y;
	scanf("%d", &n);
	for(i=1; i<=n; ++i)
	{
		for(j=1; j<=n; ++j)
		{
			scanf("%d", &a[i][j]);
		}
	}
	for(i=1; i<=n; ++i)
	{
		for(j=1; j<=n; ++j)
		{
			if(i==1 && j==1) continue;
			x=dp[i-1][j];y=dp[i][j-1];
			if(a[i][j]>=a[i-1][j]) x+=a[i][j]-a[i-1][j]+1;
			if(a[i][j]>=a[i][j-1]) y+=a[i][j]-a[i][j-1]+1;
			if(x<y) dp[i][j]=x;
			else dp[i][j]=y;
		}
	}
	printf("%d", dp[n][n]);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 39936 KB Output is correct
2 Correct 0 ms 39936 KB Output is correct
3 Correct 0 ms 39936 KB Output is correct
4 Correct 0 ms 39936 KB Output is correct
5 Correct 0 ms 39936 KB Output is correct
6 Correct 0 ms 39936 KB Output is correct
7 Correct 0 ms 39936 KB Output is correct
8 Correct 0 ms 39936 KB Output is correct
9 Correct 0 ms 39936 KB Output is correct
10 Correct 0 ms 39936 KB Output is correct
11 Correct 0 ms 39936 KB Output is correct
12 Correct 0 ms 39936 KB Output is correct
13 Correct 0 ms 39936 KB Output is correct
14 Correct 0 ms 39936 KB Output is correct
15 Correct 0 ms 39936 KB Output is correct
16 Correct 0 ms 39936 KB Output is correct
17 Correct 0 ms 39936 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 39936 KB Output is correct
2 Correct 0 ms 39936 KB Output is correct
3 Incorrect 0 ms 39936 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 39936 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 680 ms 39936 KB Output isn't correct
2 Halted 0 ms 0 KB -