# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
413218 | 2021-05-28T11:22:38 Z | aris12345678 | Maxcomp (info1cup18_maxcomp) | C++14 | 157 ms | 17032 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 = -1; 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 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 304 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
7 | Correct | 1 ms | 308 KB | Output is correct |
8 | Correct | 1 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 2 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 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 304 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
7 | Correct | 1 ms | 308 KB | Output is correct |
8 | Correct | 1 ms | 332 KB | Output is correct |
9 | Correct | 1 ms | 716 KB | Output is correct |
10 | Correct | 1 ms | 716 KB | Output is correct |
11 | Correct | 2 ms | 716 KB | Output is correct |
12 | Correct | 1 ms | 716 KB | Output is correct |
13 | Correct | 2 ms | 716 KB | Output is correct |
14 | Correct | 1 ms | 700 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 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 304 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
7 | Correct | 1 ms | 308 KB | Output is correct |
8 | Correct | 1 ms | 332 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 2 ms | 204 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 716 KB | Output is correct |
13 | Correct | 1 ms | 716 KB | Output is correct |
14 | Correct | 2 ms | 716 KB | Output is correct |
15 | Correct | 1 ms | 716 KB | Output is correct |
16 | Correct | 2 ms | 716 KB | Output is correct |
17 | Correct | 1 ms | 700 KB | Output is correct |
18 | Correct | 156 ms | 16744 KB | Output is correct |
19 | Correct | 149 ms | 16812 KB | Output is correct |
20 | Correct | 156 ms | 16324 KB | Output is correct |
21 | Correct | 154 ms | 16632 KB | Output is correct |
22 | Correct | 157 ms | 16688 KB | Output is correct |
23 | Correct | 154 ms | 16576 KB | Output is correct |
24 | Correct | 144 ms | 17032 KB | Output is correct |