답안 #8144

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
8144 2014-08-31T14:26:28 Z jhs7jhs 배열 탈출 (GA8_array) C++
6 / 100
608 ms 1120 KB
#include<stdio.h>

int d[2][2222]={0},a[2][2222]={0},n;
int min(int a,int b){if(a<b)return a;return b;}
int f(int a,int b){if(a>b)return 0;return b-a+1;}
int main()
{
	int i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++) a[1][i] = -1000;
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			scanf("%d",&a[i%2][j]);
			if(!i && !j) continue;
			d[i%2][j] = min(d[(i+1)%2][j]+f(a[(i+1)%2][j],a[i%2][j]),(j)?(d[i%2][j-1]+f(a[i%2][j-1],a[i%2][j])):1000);
		}
	}
	printf("%d",d[(n-1)%2][n-1]);
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1120 KB Output is correct
2 Correct 0 ms 1120 KB Output is correct
3 Correct 0 ms 1120 KB Output is correct
4 Correct 0 ms 1120 KB Output is correct
5 Correct 0 ms 1120 KB Output is correct
6 Correct 0 ms 1120 KB Output is correct
7 Correct 0 ms 1120 KB Output is correct
8 Correct 0 ms 1120 KB Output is correct
9 Correct 0 ms 1120 KB Output is correct
10 Correct 0 ms 1120 KB Output is correct
11 Correct 0 ms 1120 KB Output is correct
12 Correct 0 ms 1120 KB Output is correct
13 Correct 0 ms 1120 KB Output is correct
14 Correct 0 ms 1120 KB Output is correct
15 Correct 0 ms 1120 KB Output is correct
16 Correct 0 ms 1120 KB Output is correct
17 Correct 0 ms 1120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1120 KB Output is correct
2 Correct 0 ms 1120 KB Output is correct
3 Correct 0 ms 1120 KB Output is correct
4 Correct 0 ms 1120 KB Output is correct
5 Correct 0 ms 1120 KB Output is correct
6 Correct 0 ms 1120 KB Output is correct
7 Correct 0 ms 1120 KB Output is correct
8 Correct 0 ms 1120 KB Output is correct
9 Incorrect 0 ms 1120 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 1120 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 608 ms 1120 KB Output isn't correct
2 Halted 0 ms 0 KB -