답안 #84090

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
84090 2018-11-12T20:24:18 Z alextodoran Maxcomp (info1cup18_maxcomp) C++14
60 / 100
500 ms 20308 KB
#include <bits/stdc++.h>

#define NM 1002

using namespace std;

int n, m;

int ma[NM][NM];

int mx1[NM][NM], mx2[NM][NM], mx3[NM][NM], mx4[NM][NM], mx = -1;

int main()
{
    cin >> n >> m;
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            cin >> ma[i][j];
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            mx1[i][j] = max(max(mx1[i - 1][j], mx1[i][j - 1]) - 1, ma[i][j] - 1);
    for(int i = 1; i <= n; i++)
        for(int j = m; j >= 1; j--)
            mx2[i][j] = max(max(mx2[i - 1][j], mx2[i][j + 1]) - 1, ma[i][j] - 1);
    for(int i = n; i >= 1; i--)
        for(int j = 1; j <= m; j++)
            mx3[i][j] = max(max(mx3[i + 1][j], mx3[i][j - 1]) - 1, ma[i][j] - 1);
    for(int i = n; i >= 1; i--)
        for(int j = m; j >= 1; j--)
            mx4[i][j] = max(max(mx4[i + 1][j], mx4[i][j + 1]) - 1, ma[i][j] - 1);
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            mx = max(mx, max(max(mx1[i][j], mx2[i][j]), max(mx3[i][j], mx4[i][j])) - ma[i][j]);
    cout << mx << "\n";
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
4 Correct 2 ms 640 KB Output is correct
5 Correct 2 ms 640 KB Output is correct
6 Correct 2 ms 640 KB Output is correct
7 Correct 2 ms 656 KB Output is correct
8 Correct 2 ms 672 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 672 KB Output is correct
2 Correct 3 ms 672 KB Output is correct
3 Correct 3 ms 672 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
4 Correct 2 ms 640 KB Output is correct
5 Correct 2 ms 640 KB Output is correct
6 Correct 2 ms 640 KB Output is correct
7 Correct 2 ms 656 KB Output is correct
8 Correct 2 ms 672 KB Output is correct
9 Correct 5 ms 1488 KB Output is correct
10 Correct 4 ms 1508 KB Output is correct
11 Correct 5 ms 1660 KB Output is correct
12 Correct 4 ms 1732 KB Output is correct
13 Correct 5 ms 1732 KB Output is correct
14 Correct 4 ms 1732 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
4 Correct 2 ms 640 KB Output is correct
5 Correct 2 ms 640 KB Output is correct
6 Correct 2 ms 640 KB Output is correct
7 Correct 2 ms 656 KB Output is correct
8 Correct 2 ms 672 KB Output is correct
9 Correct 2 ms 672 KB Output is correct
10 Correct 3 ms 672 KB Output is correct
11 Correct 3 ms 672 KB Output is correct
12 Correct 5 ms 1488 KB Output is correct
13 Correct 4 ms 1508 KB Output is correct
14 Correct 5 ms 1660 KB Output is correct
15 Correct 4 ms 1732 KB Output is correct
16 Correct 5 ms 1732 KB Output is correct
17 Correct 4 ms 1732 KB Output is correct
18 Execution timed out 509 ms 20308 KB Time limit exceeded
19 Halted 0 ms 0 KB -