Submission #7602

# Submission time Handle Problem Language Result Execution time Memory
7602 2014-08-12T10:44:37 Z gs13031 배열 탈출 (GA8_array) C++
0 / 100
612 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]);
		}
	}
	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]);
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 39936 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 39936 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 39936 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 612 ms 39936 KB Output isn't correct
2 Halted 0 ms 0 KB -