답안 #8022

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
8022 2014-08-27T06:08:54 Z lingxiang 배열 탈출 (GA8_array) C++
100 / 100
612 ms 49916 KB
#include<stdio.h>

int N;
int D[2500][2500], T[2500][2500];
int fn(int x){return x<0? 0:x;}
int min(int a,int b){return a<b? a:b;}

int input(){
	scanf("%d",&N);
	for(int i=1;i<=N;i++){
		for(int j=1;j<=N;j++){
			scanf("%d",&T[i][j]);
		}
	}
	for(int i=0;i<2500;i++)for(int j=0;j<2500;j++)D[i][j]=0x6fffffff;
	return 0;
}

int solve(){
	for(int i=1;i<=N;i++) for(int j=1;j<=N;j++){
		if(i==1&&j==1){
			D[i][j]=0;
			continue;
		}
		D[i][j]=min(D[i-1][j]+fn(T[i][j]-T[i-1][j]+1),D[i][j-1]+fn(T[i][j]-T[i][j-1]+1));
	}
	return 0;
}

int output(){
	printf("%d",D[N][N]);
	return 0;
}

int main(){
	input();
	solve();
	output();
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 49916 KB Output is correct
2 Correct 0 ms 49916 KB Output is correct
3 Correct 4 ms 49916 KB Output is correct
4 Correct 0 ms 49916 KB Output is correct
5 Correct 4 ms 49916 KB Output is correct
6 Correct 0 ms 49916 KB Output is correct
7 Correct 4 ms 49916 KB Output is correct
8 Correct 4 ms 49916 KB Output is correct
9 Correct 4 ms 49916 KB Output is correct
10 Correct 0 ms 49916 KB Output is correct
11 Correct 4 ms 49916 KB Output is correct
12 Correct 4 ms 49916 KB Output is correct
13 Correct 12 ms 49916 KB Output is correct
14 Correct 0 ms 49916 KB Output is correct
15 Correct 4 ms 49916 KB Output is correct
16 Correct 0 ms 49916 KB Output is correct
17 Correct 8 ms 49916 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 49916 KB Output is correct
2 Correct 4 ms 49916 KB Output is correct
3 Correct 4 ms 49916 KB Output is correct
4 Correct 4 ms 49916 KB Output is correct
5 Correct 0 ms 49916 KB Output is correct
6 Correct 0 ms 49916 KB Output is correct
7 Correct 4 ms 49916 KB Output is correct
8 Correct 0 ms 49916 KB Output is correct
9 Correct 0 ms 49916 KB Output is correct
10 Correct 0 ms 49916 KB Output is correct
11 Correct 8 ms 49916 KB Output is correct
12 Correct 4 ms 49916 KB Output is correct
13 Correct 8 ms 49916 KB Output is correct
14 Correct 4 ms 49916 KB Output is correct
15 Correct 0 ms 49916 KB Output is correct
16 Correct 12 ms 49916 KB Output is correct
17 Correct 4 ms 49916 KB Output is correct
18 Correct 8 ms 49916 KB Output is correct
19 Correct 0 ms 49916 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 49916 KB Output is correct
2 Correct 8 ms 49916 KB Output is correct
3 Correct 8 ms 49916 KB Output is correct
4 Correct 16 ms 49916 KB Output is correct
5 Correct 12 ms 49916 KB Output is correct
6 Correct 12 ms 49916 KB Output is correct
7 Correct 16 ms 49916 KB Output is correct
8 Correct 8 ms 49916 KB Output is correct
9 Correct 4 ms 49916 KB Output is correct
10 Correct 8 ms 49916 KB Output is correct
11 Correct 12 ms 49916 KB Output is correct
12 Correct 8 ms 49916 KB Output is correct
13 Correct 8 ms 49916 KB Output is correct
14 Correct 8 ms 49916 KB Output is correct
15 Correct 8 ms 49916 KB Output is correct
16 Correct 20 ms 49916 KB Output is correct
17 Correct 8 ms 49916 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 612 ms 49916 KB Output is correct
2 Correct 592 ms 49916 KB Output is correct
3 Correct 596 ms 49916 KB Output is correct
4 Correct 580 ms 49916 KB Output is correct
5 Correct 484 ms 49916 KB Output is correct
6 Correct 516 ms 49916 KB Output is correct
7 Correct 588 ms 49916 KB Output is correct
8 Correct 596 ms 49916 KB Output is correct
9 Correct 596 ms 49916 KB Output is correct
10 Correct 564 ms 49916 KB Output is correct
11 Correct 544 ms 49916 KB Output is correct
12 Correct 536 ms 49916 KB Output is correct
13 Correct 484 ms 49916 KB Output is correct
14 Correct 552 ms 49916 KB Output is correct
15 Correct 460 ms 49916 KB Output is correct
16 Correct 568 ms 49916 KB Output is correct
17 Correct 548 ms 49916 KB Output is correct
18 Correct 528 ms 49916 KB Output is correct
19 Correct 552 ms 49916 KB Output is correct
20 Correct 552 ms 49916 KB Output is correct
21 Correct 520 ms 49916 KB Output is correct