Submission #8019

# Submission time Handle Problem Language Result Execution time Memory
8019 2014-08-27T06:04:24 Z paulsohn 배열 탈출 (GA8_array) C++
100 / 100
660 ms 39728 KB
#include <stdio.h>
int n, A[2224][2224] = { 0 }, cost[2224][2224] = { 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 39728 KB Output is correct
2 Correct 0 ms 39728 KB Output is correct
3 Correct 0 ms 39728 KB Output is correct
4 Correct 0 ms 39728 KB Output is correct
5 Correct 0 ms 39728 KB Output is correct
6 Correct 0 ms 39728 KB Output is correct
7 Correct 0 ms 39728 KB Output is correct
8 Correct 0 ms 39728 KB Output is correct
9 Correct 0 ms 39728 KB Output is correct
10 Correct 0 ms 39728 KB Output is correct
11 Correct 0 ms 39728 KB Output is correct
12 Correct 0 ms 39728 KB Output is correct
13 Correct 0 ms 39728 KB Output is correct
14 Correct 0 ms 39728 KB Output is correct
15 Correct 0 ms 39728 KB Output is correct
16 Correct 0 ms 39728 KB Output is correct
17 Correct 0 ms 39728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 39728 KB Output is correct
2 Correct 0 ms 39728 KB Output is correct
3 Correct 0 ms 39728 KB Output is correct
4 Correct 0 ms 39728 KB Output is correct
5 Correct 0 ms 39728 KB Output is correct
6 Correct 0 ms 39728 KB Output is correct
7 Correct 0 ms 39728 KB Output is correct
8 Correct 0 ms 39728 KB Output is correct
9 Correct 0 ms 39728 KB Output is correct
10 Correct 0 ms 39728 KB Output is correct
11 Correct 0 ms 39728 KB Output is correct
12 Correct 0 ms 39728 KB Output is correct
13 Correct 0 ms 39728 KB Output is correct
14 Correct 0 ms 39728 KB Output is correct
15 Correct 0 ms 39728 KB Output is correct
16 Correct 0 ms 39728 KB Output is correct
17 Correct 0 ms 39728 KB Output is correct
18 Correct 0 ms 39728 KB Output is correct
19 Correct 0 ms 39728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 39728 KB Output is correct
2 Correct 4 ms 39728 KB Output is correct
3 Correct 4 ms 39728 KB Output is correct
4 Correct 8 ms 39728 KB Output is correct
5 Correct 8 ms 39728 KB Output is correct
6 Correct 4 ms 39728 KB Output is correct
7 Correct 0 ms 39728 KB Output is correct
8 Correct 8 ms 39728 KB Output is correct
9 Correct 4 ms 39728 KB Output is correct
10 Correct 4 ms 39728 KB Output is correct
11 Correct 4 ms 39728 KB Output is correct
12 Correct 8 ms 39728 KB Output is correct
13 Correct 8 ms 39728 KB Output is correct
14 Correct 0 ms 39728 KB Output is correct
15 Correct 8 ms 39728 KB Output is correct
16 Correct 4 ms 39728 KB Output is correct
17 Correct 4 ms 39728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 660 ms 39728 KB Output is correct
2 Correct 628 ms 39728 KB Output is correct
3 Correct 656 ms 39728 KB Output is correct
4 Correct 652 ms 39728 KB Output is correct
5 Correct 528 ms 39728 KB Output is correct
6 Correct 592 ms 39728 KB Output is correct
7 Correct 652 ms 39728 KB Output is correct
8 Correct 624 ms 39728 KB Output is correct
9 Correct 620 ms 39728 KB Output is correct
10 Correct 568 ms 39728 KB Output is correct
11 Correct 568 ms 39728 KB Output is correct
12 Correct 568 ms 39728 KB Output is correct
13 Correct 520 ms 39728 KB Output is correct
14 Correct 584 ms 39728 KB Output is correct
15 Correct 468 ms 39728 KB Output is correct
16 Correct 560 ms 39728 KB Output is correct
17 Correct 588 ms 39728 KB Output is correct
18 Correct 504 ms 39728 KB Output is correct
19 Correct 556 ms 39728 KB Output is correct
20 Correct 580 ms 39728 KB Output is correct
21 Correct 544 ms 39728 KB Output is correct