# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
44907 | 2018-04-09T09:23:47 Z | ulna | Maxcomp (info1cup18_maxcomp) | C++11 | 200 ms | 4732 KB |
#include <bits/stdc++.h> using namespace std; // why am I so weak int n, m; int a[1055][1055]; int dp[1055]; int solve() { int res = -INT_MAX; for (int j = 0; j < m; j++) { dp[j] = -(int)1e9; } for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { dp[j]--; } { int roll = -(int)1e9; for (int j = 0; j < m; j++) { roll--; roll = max(roll, -a[i][j] - 1); roll = max(roll, dp[j]); dp[j] = roll; } } { int roll = -(int)1e9; for (int j = m - 1; j >= 0; j--) { roll--; roll = max(roll, -a[i][j] - 1); roll = max(roll, dp[j]); dp[j] = roll; } } for (int j = 0; j < m; j++) { res = max(res, a[i][j] + dp[j]); } } return res; } int main() { scanf("%d %d", &n, &m); for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) { scanf("%d", &a[i][j]); } int res = -1; res = max(res, solve()); for (int i = 0; i < n / 2; i++) { swap(a[i], a[n - i - 1]); } res = max(res, solve()); cout << res << endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 428 KB | Output is correct |
4 | Correct | 2 ms | 428 KB | Output is correct |
5 | Correct | 2 ms | 488 KB | Output is correct |
6 | Correct | 2 ms | 488 KB | Output is correct |
7 | Correct | 2 ms | 488 KB | Output is correct |
8 | Correct | 2 ms | 520 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 520 KB | Output is correct |
2 | Correct | 2 ms | 720 KB | Output is correct |
3 | Correct | 2 ms | 720 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 428 KB | Output is correct |
4 | Correct | 2 ms | 428 KB | Output is correct |
5 | Correct | 2 ms | 488 KB | Output is correct |
6 | Correct | 2 ms | 488 KB | Output is correct |
7 | Correct | 2 ms | 488 KB | Output is correct |
8 | Correct | 2 ms | 520 KB | Output is correct |
9 | Correct | 3 ms | 744 KB | Output is correct |
10 | Correct | 2 ms | 744 KB | Output is correct |
11 | Correct | 2 ms | 744 KB | Output is correct |
12 | Correct | 2 ms | 744 KB | Output is correct |
13 | Correct | 2 ms | 744 KB | Output is correct |
14 | Correct | 2 ms | 744 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 428 KB | Output is correct |
4 | Correct | 2 ms | 428 KB | Output is correct |
5 | Correct | 2 ms | 488 KB | Output is correct |
6 | Correct | 2 ms | 488 KB | Output is correct |
7 | Correct | 2 ms | 488 KB | Output is correct |
8 | Correct | 2 ms | 520 KB | Output is correct |
9 | Correct | 2 ms | 520 KB | Output is correct |
10 | Correct | 2 ms | 720 KB | Output is correct |
11 | Correct | 2 ms | 720 KB | Output is correct |
12 | Correct | 3 ms | 744 KB | Output is correct |
13 | Correct | 2 ms | 744 KB | Output is correct |
14 | Correct | 2 ms | 744 KB | Output is correct |
15 | Correct | 2 ms | 744 KB | Output is correct |
16 | Correct | 2 ms | 744 KB | Output is correct |
17 | Correct | 2 ms | 744 KB | Output is correct |
18 | Correct | 191 ms | 4708 KB | Output is correct |
19 | Correct | 190 ms | 4716 KB | Output is correct |
20 | Correct | 200 ms | 4716 KB | Output is correct |
21 | Correct | 184 ms | 4716 KB | Output is correct |
22 | Correct | 199 ms | 4716 KB | Output is correct |
23 | Correct | 193 ms | 4732 KB | Output is correct |
24 | Correct | 149 ms | 4732 KB | Output is correct |