# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
413215 | 2021-05-28T11:21:08 Z | aris12345678 | Maxcomp (info1cup18_maxcomp) | C++14 | 1 ms | 332 KB |
#include <bits/stdc++.h> using namespace std; const int mxN = 1e3+5; int a[mxN][mxN], dp[mxN][mxN]; int main() { int n, m; scanf("%d %d", &n, &m); for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { scanf("%d", &a[i][j]); } } for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { dp[i][j] = a[i][j]-1; if(i > 0) dp[i][j] = max(dp[i][j], dp[i-1][j]-1); if(j > 0) dp[i][j] = max(dp[i][j], dp[i][j-1]-1); } } for(int i = n-1; i >= 0; i--) { for(int j = m-1; j >= 0; j--) { if(i < n-1) dp[i][j] = max(dp[i][j], dp[i+1][j]-1); if(j < m-1) dp[i][j] = max(dp[i][j], dp[i][j+1]-1); } } int ans = 0; for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { ans = max(ans, dp[i][j]-a[i][j]); } } printf("%d\n", ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Incorrect | 1 ms | 300 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Incorrect | 1 ms | 300 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Incorrect | 1 ms | 300 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |