Submission #7224

# Submission time Handle Problem Language Result Execution time Memory
7224 2014-07-28T11:44:09 Z gs13068 배열 탈출 (GA8_array) C++
0 / 100
604 ms 20372 KB
#include<cstdio>
#include<algorithm>

int a[2222][2222];

int main()
{
	int i,j,n,r=0;
	scanf("%d",&n);
    for(i=0;i<n;i++)for(j=0;j<n;j++)scanf("%d",&a[i][j]);
    i=j=0;
    while(i!=n-1||j!=n-1)
	{
		if(i==n-1)
		{
			r+=std::max(a[i][j+1]-a[i][j]+1,0);
			j++;
		}
		else if(j==n-1)
		{
			r+=std::max(a[i+1][j]-a[i][j]+1,0);
			i++;
		}
		else
		{
			if(std::max(a[i][j+1]-a[i][j]+1,0)<std::max(a[i+1][j]-a[i][j]+1,0))
			{
				r+=std::max(a[i][j+1]-a[i][j]+1,0);
				j++;
			}
			else if(std::max(a[i][j+1]-a[i][j]+1,0)>std::max(a[i+1][j]-a[i][j]+1,0))
			{
				r+=std::max(a[i+1][j]-a[i][j]+1,0);
				i++;
			}
			else if(a[i][j+1]>a[i+1][j])
			{
				r+=std::max(a[i][j+1]-a[i][j]+1,0);
				j++;
			}
			else
			{
				r+=std::max(a[i+1][j]-a[i][j]+1,0);
				i++;
			}
		}
		printf("%d %d %d\n",i,j,r);
	}
	printf("%d",r);
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 20372 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 20372 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 20372 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 604 ms 20372 KB Output isn't correct
2 Halted 0 ms 0 KB -