답안 #7886

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
7886 2014-08-23T02:46:39 Z qja0950 배열 탈출 (GA8_array) C++
100 / 100
644 ms 43572 KB
#include <stdio.h>

#define MAXN 2332
#define INF 2100000000

int N;
int Number[MAXN][MAXN];
int Dy[MAXN][MAXN];

int MIN(int x, int y) {
	if(x>y) return y;
	else return x;
}
int Money(int now, int next) {
	if(now>next) return 0;
	return next-now+1;
}
int main() {
	scanf("%d", &N);
	for(int i=0; i<=N; i++) Dy[0][i] = Dy[i][0] = INF;
	for(int i=1; i<=N; i++) {
		for(int j=1; j<=N; j++) {
			scanf("%d", &Number[i][j]);
			if(i==1 && j==1) continue;
			Dy[i][j] = MIN(Dy[i-1][j] + Money(Number[i-1][j], Number[i][j])
						,  Dy[i][j-1] + Money(Number[i][j-1], Number[i][j]));
		}
	}
	printf("%d", Dy[N][N]);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 43572 KB Output is correct
2 Correct 0 ms 43572 KB Output is correct
3 Correct 0 ms 43572 KB Output is correct
4 Correct 0 ms 43572 KB Output is correct
5 Correct 0 ms 43572 KB Output is correct
6 Correct 0 ms 43572 KB Output is correct
7 Correct 0 ms 43572 KB Output is correct
8 Correct 0 ms 43572 KB Output is correct
9 Correct 0 ms 43572 KB Output is correct
10 Correct 0 ms 43572 KB Output is correct
11 Correct 0 ms 43572 KB Output is correct
12 Correct 0 ms 43572 KB Output is correct
13 Correct 0 ms 43572 KB Output is correct
14 Correct 0 ms 43572 KB Output is correct
15 Correct 0 ms 43572 KB Output is correct
16 Correct 0 ms 43572 KB Output is correct
17 Correct 0 ms 43572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 43572 KB Output is correct
2 Correct 0 ms 43572 KB Output is correct
3 Correct 0 ms 43572 KB Output is correct
4 Correct 0 ms 43572 KB Output is correct
5 Correct 0 ms 43572 KB Output is correct
6 Correct 0 ms 43572 KB Output is correct
7 Correct 0 ms 43572 KB Output is correct
8 Correct 0 ms 43572 KB Output is correct
9 Correct 0 ms 43572 KB Output is correct
10 Correct 0 ms 43572 KB Output is correct
11 Correct 0 ms 43572 KB Output is correct
12 Correct 0 ms 43572 KB Output is correct
13 Correct 0 ms 43572 KB Output is correct
14 Correct 0 ms 43572 KB Output is correct
15 Correct 0 ms 43572 KB Output is correct
16 Correct 0 ms 43572 KB Output is correct
17 Correct 0 ms 43572 KB Output is correct
18 Correct 0 ms 43572 KB Output is correct
19 Correct 0 ms 43572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 43572 KB Output is correct
2 Correct 8 ms 43572 KB Output is correct
3 Correct 4 ms 43572 KB Output is correct
4 Correct 4 ms 43572 KB Output is correct
5 Correct 8 ms 43572 KB Output is correct
6 Correct 4 ms 43572 KB Output is correct
7 Correct 8 ms 43572 KB Output is correct
8 Correct 8 ms 43572 KB Output is correct
9 Correct 0 ms 43572 KB Output is correct
10 Correct 4 ms 43572 KB Output is correct
11 Correct 4 ms 43572 KB Output is correct
12 Correct 8 ms 43572 KB Output is correct
13 Correct 8 ms 43572 KB Output is correct
14 Correct 0 ms 43572 KB Output is correct
15 Correct 8 ms 43572 KB Output is correct
16 Correct 8 ms 43572 KB Output is correct
17 Correct 8 ms 43572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 644 ms 43572 KB Output is correct
2 Correct 620 ms 43572 KB Output is correct
3 Correct 628 ms 43572 KB Output is correct
4 Correct 632 ms 43572 KB Output is correct
5 Correct 520 ms 43572 KB Output is correct
6 Correct 588 ms 43572 KB Output is correct
7 Correct 636 ms 43572 KB Output is correct
8 Correct 616 ms 43572 KB Output is correct
9 Correct 628 ms 43572 KB Output is correct
10 Correct 560 ms 43572 KB Output is correct
11 Correct 576 ms 43572 KB Output is correct
12 Correct 568 ms 43572 KB Output is correct
13 Correct 512 ms 43572 KB Output is correct
14 Correct 572 ms 43572 KB Output is correct
15 Correct 472 ms 43572 KB Output is correct
16 Correct 612 ms 43572 KB Output is correct
17 Correct 592 ms 43572 KB Output is correct
18 Correct 536 ms 43572 KB Output is correct
19 Correct 572 ms 43572 KB Output is correct
20 Correct 592 ms 43572 KB Output is correct
21 Correct 512 ms 43572 KB Output is correct