# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
45531 | 2018-04-15T00:55:12 Z | IvanC | Maxcomp (info1cup18_maxcomp) | C++17 | 206 ms | 56176 KB |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e3 + 10; const int INF = 1e9 + 1e4; int N,M,matriz[MAXN][MAXN],linear[MAXN],melhor; int main(){ scanf("%d %d",&N,&M); melhor = 0; for(int i = 1;i<=N;i++){ for(int j = 1;j<=M;j++){ scanf("%d",&matriz[i][j]); } } for(int i = 1;i<=N;i++) linear[i] = INF; for(int j = 1;j<=M;j++){ int menor = INF; for(int i = 1;i<=N;i++){ linear[i] = min(linear[i] + 1, matriz[i][j] ); menor = min(menor+1,linear[i]); melhor = max(melhor, matriz[i][j] - menor ); } menor = INF; for(int i = N;i>=1;i--){ menor = min(menor+1,linear[i]); melhor = max(melhor, matriz[i][j] - menor ); } } for(int i = 1;i<=N;i++) linear[i] = INF; for(int j = M;j>=1;j--){ int menor = INF; for(int i = 1;i<=N;i++){ linear[i] = min(linear[i] + 1, matriz[i][j] ); menor = min(menor+1,linear[i]); melhor = max(melhor, matriz[i][j] - menor ); } menor = INF; for(int i = N;i>=1;i--){ menor = min(menor+1,linear[i]); melhor = max(melhor, matriz[i][j] - menor ); } } printf("%d\n",melhor - 1); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 488 KB | Output is correct |
3 | Correct | 2 ms | 544 KB | Output is correct |
4 | Correct | 2 ms | 544 KB | Output is correct |
5 | Correct | 2 ms | 544 KB | Output is correct |
6 | Correct | 2 ms | 544 KB | Output is correct |
7 | Correct | 2 ms | 544 KB | Output is correct |
8 | Correct | 2 ms | 544 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 544 KB | Output is correct |
2 | Correct | 2 ms | 544 KB | Output is correct |
3 | Correct | 2 ms | 544 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 488 KB | Output is correct |
3 | Correct | 2 ms | 544 KB | Output is correct |
4 | Correct | 2 ms | 544 KB | Output is correct |
5 | Correct | 2 ms | 544 KB | Output is correct |
6 | Correct | 2 ms | 544 KB | Output is correct |
7 | Correct | 2 ms | 544 KB | Output is correct |
8 | Correct | 2 ms | 544 KB | Output is correct |
9 | Correct | 2 ms | 656 KB | Output is correct |
10 | Correct | 2 ms | 680 KB | Output is correct |
11 | Correct | 2 ms | 724 KB | Output is correct |
12 | Correct | 3 ms | 724 KB | Output is correct |
13 | Correct | 2 ms | 724 KB | Output is correct |
14 | Correct | 2 ms | 748 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 488 KB | Output is correct |
3 | Correct | 2 ms | 544 KB | Output is correct |
4 | Correct | 2 ms | 544 KB | Output is correct |
5 | Correct | 2 ms | 544 KB | Output is correct |
6 | Correct | 2 ms | 544 KB | Output is correct |
7 | Correct | 2 ms | 544 KB | Output is correct |
8 | Correct | 2 ms | 544 KB | Output is correct |
9 | Correct | 2 ms | 544 KB | Output is correct |
10 | Correct | 2 ms | 544 KB | Output is correct |
11 | Correct | 2 ms | 544 KB | Output is correct |
12 | Correct | 2 ms | 656 KB | Output is correct |
13 | Correct | 2 ms | 680 KB | Output is correct |
14 | Correct | 2 ms | 724 KB | Output is correct |
15 | Correct | 3 ms | 724 KB | Output is correct |
16 | Correct | 2 ms | 724 KB | Output is correct |
17 | Correct | 2 ms | 748 KB | Output is correct |
18 | Correct | 202 ms | 4564 KB | Output is correct |
19 | Correct | 206 ms | 13036 KB | Output is correct |
20 | Correct | 196 ms | 21620 KB | Output is correct |
21 | Correct | 197 ms | 29800 KB | Output is correct |
22 | Correct | 200 ms | 38392 KB | Output is correct |
23 | Correct | 203 ms | 46984 KB | Output is correct |
24 | Correct | 179 ms | 56176 KB | Output is correct |