Submission #7470

# Submission time Handle Problem Language Result Execution time Memory
7470 2014-08-09T06:21:29 Z kipa00 배열 탈출 (GA8_array) C++
100 / 100
632 ms 39660 KB
#include <cstdio>

int map[2222][2222];
int dp[2222][2222];

int v(int s, int e) {
  return (s > e) ? 0 : (e - s + 1);
}

int main() {
  int n, i, j;
  scanf("%d", &n);
  // 미친;
  // 하... 이런 선언 실수를 하다니. 한심하다... 에휴
  for (i=0; i<n; ++i) {
    for (j=0; j<n; ++j) {
      scanf("%d", &map[i][j]);
    }
  }
  for (j=1; j<n; ++j) {
    dp[0][j] = dp[0][j - 1] + v(map[0][j - 1], map[0][j]);
  }
  for (i=1; i<n; ++i) {
    for (j=0; j<n; ++j) {
      int temp = dp[i - 1][j] + v(map[i - 1][j], map[i][j]);
      if (j != 0) {
        int temp2 = dp[i][j - 1] + v(map[i][j - 1], map[i][j]);
        if (temp > temp2) {
          temp = temp2;
        }
      }
      dp[i][j] = temp;
    }
  }
  printf("%d\n", dp[n - 1][n - 1]);
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 39660 KB Output is correct
2 Correct 0 ms 39660 KB Output is correct
3 Correct 0 ms 39660 KB Output is correct
4 Correct 0 ms 39660 KB Output is correct
5 Correct 0 ms 39660 KB Output is correct
6 Correct 0 ms 39660 KB Output is correct
7 Correct 0 ms 39660 KB Output is correct
8 Correct 0 ms 39660 KB Output is correct
9 Correct 0 ms 39660 KB Output is correct
10 Correct 0 ms 39660 KB Output is correct
11 Correct 0 ms 39660 KB Output is correct
12 Correct 0 ms 39660 KB Output is correct
13 Correct 0 ms 39660 KB Output is correct
14 Correct 0 ms 39660 KB Output is correct
15 Correct 0 ms 39660 KB Output is correct
16 Correct 0 ms 39660 KB Output is correct
17 Correct 0 ms 39660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 39660 KB Output is correct
2 Correct 0 ms 39660 KB Output is correct
3 Correct 0 ms 39660 KB Output is correct
4 Correct 0 ms 39660 KB Output is correct
5 Correct 0 ms 39660 KB Output is correct
6 Correct 0 ms 39660 KB Output is correct
7 Correct 0 ms 39660 KB Output is correct
8 Correct 0 ms 39660 KB Output is correct
9 Correct 0 ms 39660 KB Output is correct
10 Correct 0 ms 39660 KB Output is correct
11 Correct 0 ms 39660 KB Output is correct
12 Correct 0 ms 39660 KB Output is correct
13 Correct 0 ms 39660 KB Output is correct
14 Correct 0 ms 39660 KB Output is correct
15 Correct 0 ms 39660 KB Output is correct
16 Correct 0 ms 39660 KB Output is correct
17 Correct 0 ms 39660 KB Output is correct
18 Correct 0 ms 39660 KB Output is correct
19 Correct 0 ms 39660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 39660 KB Output is correct
2 Correct 8 ms 39660 KB Output is correct
3 Correct 4 ms 39660 KB Output is correct
4 Correct 8 ms 39660 KB Output is correct
5 Correct 8 ms 39660 KB Output is correct
6 Correct 4 ms 39660 KB Output is correct
7 Correct 8 ms 39660 KB Output is correct
8 Correct 4 ms 39660 KB Output is correct
9 Correct 4 ms 39660 KB Output is correct
10 Correct 8 ms 39660 KB Output is correct
11 Correct 4 ms 39660 KB Output is correct
12 Correct 0 ms 39660 KB Output is correct
13 Correct 4 ms 39660 KB Output is correct
14 Correct 4 ms 39660 KB Output is correct
15 Correct 4 ms 39660 KB Output is correct
16 Correct 0 ms 39660 KB Output is correct
17 Correct 4 ms 39660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 628 ms 39660 KB Output is correct
2 Correct 632 ms 39660 KB Output is correct
3 Correct 612 ms 39660 KB Output is correct
4 Correct 620 ms 39660 KB Output is correct
5 Correct 504 ms 39660 KB Output is correct
6 Correct 588 ms 39660 KB Output is correct
7 Correct 600 ms 39660 KB Output is correct
8 Correct 600 ms 39660 KB Output is correct
9 Correct 616 ms 39660 KB Output is correct
10 Correct 560 ms 39660 KB Output is correct
11 Correct 552 ms 39660 KB Output is correct
12 Correct 540 ms 39660 KB Output is correct
13 Correct 512 ms 39660 KB Output is correct
14 Correct 548 ms 39660 KB Output is correct
15 Correct 460 ms 39660 KB Output is correct
16 Correct 556 ms 39660 KB Output is correct
17 Correct 564 ms 39660 KB Output is correct
18 Correct 504 ms 39660 KB Output is correct
19 Correct 584 ms 39660 KB Output is correct
20 Correct 552 ms 39660 KB Output is correct
21 Correct 512 ms 39660 KB Output is correct