# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1085241 | 2024-09-07T17:59:38 Z | medv | Maxcomp (info1cup18_maxcomp) | C++14 | 95 ms | 17088 KB |
#include <cstdio> #include <algorithm> #include <vector> #define INF 1000000010 #define MAX 1010 using namespace std; int n, m; int a[MAX][MAX]; int dp[MAX][MAX]; int ans = -INF; void f() { for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) { dp[i][j] = a[i][j]; if (i > 1) dp[i][j] = max(dp[i][j], dp[i - 1][j] - 1); if (j > 1) dp[i][j] = max(dp[i][j], dp[i][j - 1] - 1); ans = max(ans, dp[i][j] - a[i][j] - 1); } } int main() { scanf("%d %d", &n, &m); for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) scanf("%d", &a[i][j]); ans = -INF; f(); for (int i = 1; i <= n / 2; i++) for (int j = 1; j <= m; j++) swap(a[i][j], a[n - i + 1][j]); f(); for (int i = 1; i <= n; i++) for (int j = 1; j <= m / 2; j++) swap(a[i][j], a[i][m - j + 1]); f(); for (int i = 1; i <= n / 2; i++) for (int j = 1; j <= m; j++) swap(a[i][j], a[n - i + 1][j]); f(); printf("%d\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 600 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 428 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 600 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 428 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 600 KB | Output is correct |
10 | Correct | 1 ms | 604 KB | Output is correct |
11 | Correct | 1 ms | 696 KB | Output is correct |
12 | Correct | 0 ms | 696 KB | Output is correct |
13 | Correct | 1 ms | 604 KB | Output is correct |
14 | Correct | 1 ms | 604 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 600 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 428 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 1 ms | 600 KB | Output is correct |
13 | Correct | 1 ms | 604 KB | Output is correct |
14 | Correct | 1 ms | 696 KB | Output is correct |
15 | Correct | 0 ms | 696 KB | Output is correct |
16 | Correct | 1 ms | 604 KB | Output is correct |
17 | Correct | 1 ms | 604 KB | Output is correct |
18 | Correct | 86 ms | 16716 KB | Output is correct |
19 | Correct | 85 ms | 16796 KB | Output is correct |
20 | Correct | 80 ms | 16256 KB | Output is correct |
21 | Correct | 84 ms | 16688 KB | Output is correct |
22 | Correct | 83 ms | 16724 KB | Output is correct |
23 | Correct | 95 ms | 16588 KB | Output is correct |
24 | Correct | 86 ms | 17088 KB | Output is correct |