Submission #7470

#TimeUsernameProblemLanguageResultExecution timeMemory
7470kipa00배열 탈출 (GA8_array)C++98
100 / 100
632 ms39660 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...