Submission #8016

# Submission time Handle Problem Language Result Execution time Memory
8016 2014-08-27T06:00:16 Z paulsohn 배열 탈출 (GA8_array) C++
49 / 100
60 ms 1480 KB
#include <stdio.h>
int n, A[224][224] = { 0 }, cost[224][224] = { 0 };
int main(){
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i){
		for (int j = 1; j <= n; ++j){
			scanf("%d", &A[i][j]);
		}
	}
	for (int i = n; i; --i){
		for (int j = n; j; --j){
			int rcost = cost[i][j + 1] + (A[i][j] > A[i][j + 1] ? 0 : A[i][j + 1] - A[i][j] + 1);
			int dcost = cost[i + 1][j] + (A[i][j] > A[i + 1][j] ? 0 : A[i + 1][j] - A[i][j] + 1);
			if (i == n && j == n) cost[n][n] = 0;
			else if (i == n) cost[n][j] = rcost;
			else if (j == n) cost[i][n] = dcost;
			else cost[i][j] = (rcost > dcost ? dcost : rcost);
		}
	}
	printf("%d\n", cost[1][1]);
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1480 KB Output is correct
2 Correct 0 ms 1480 KB Output is correct
3 Correct 0 ms 1480 KB Output is correct
4 Correct 0 ms 1480 KB Output is correct
5 Correct 0 ms 1480 KB Output is correct
6 Correct 0 ms 1480 KB Output is correct
7 Correct 0 ms 1480 KB Output is correct
8 Correct 0 ms 1480 KB Output is correct
9 Correct 0 ms 1480 KB Output is correct
10 Correct 0 ms 1480 KB Output is correct
11 Correct 0 ms 1480 KB Output is correct
12 Correct 0 ms 1480 KB Output is correct
13 Correct 0 ms 1480 KB Output is correct
14 Correct 0 ms 1480 KB Output is correct
15 Correct 0 ms 1480 KB Output is correct
16 Correct 0 ms 1480 KB Output is correct
17 Correct 0 ms 1480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1480 KB Output is correct
2 Correct 0 ms 1480 KB Output is correct
3 Correct 0 ms 1480 KB Output is correct
4 Correct 0 ms 1480 KB Output is correct
5 Correct 0 ms 1480 KB Output is correct
6 Correct 0 ms 1480 KB Output is correct
7 Correct 0 ms 1480 KB Output is correct
8 Correct 0 ms 1480 KB Output is correct
9 Correct 0 ms 1480 KB Output is correct
10 Correct 0 ms 1480 KB Output is correct
11 Correct 0 ms 1480 KB Output is correct
12 Correct 0 ms 1480 KB Output is correct
13 Correct 0 ms 1480 KB Output is correct
14 Correct 0 ms 1480 KB Output is correct
15 Correct 0 ms 1480 KB Output is correct
16 Correct 0 ms 1480 KB Output is correct
17 Correct 0 ms 1480 KB Output is correct
18 Correct 0 ms 1480 KB Output is correct
19 Correct 0 ms 1480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1480 KB Output is correct
2 Correct 8 ms 1480 KB Output is correct
3 Correct 4 ms 1480 KB Output is correct
4 Correct 8 ms 1480 KB Output is correct
5 Correct 4 ms 1480 KB Output is correct
6 Correct 8 ms 1480 KB Output is correct
7 Correct 8 ms 1480 KB Output is correct
8 Correct 4 ms 1480 KB Output is correct
9 Correct 4 ms 1480 KB Output is correct
10 Correct 4 ms 1480 KB Output is correct
11 Correct 4 ms 1480 KB Output is correct
12 Correct 4 ms 1480 KB Output is correct
13 Correct 8 ms 1480 KB Output is correct
14 Correct 0 ms 1480 KB Output is correct
15 Correct 4 ms 1480 KB Output is correct
16 Correct 4 ms 1480 KB Output is correct
17 Correct 4 ms 1480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 60 ms 1480 KB Output isn't correct
2 Halted 0 ms 0 KB -