Submission #7469

#TimeUsernameProblemLanguageResultExecution timeMemory
7469kipa00배열 탈출 (GA8_array)C++98
Compilation error
0 ms0 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; 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; }

Compilation message (stderr)

grid.cpp: In function 'int main()':
grid.cpp:14:8: error: 'i' was not declared in this scope
grid.cpp:15:10: error: 'j' was not declared in this scope
grid.cpp:19:8: error: 'j' was not declared in this scope
grid.cpp:12:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]