답안 #645001

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
645001 2022-09-25T19:17:38 Z notme Maxcomp (info1cup18_maxcomp) C++14
15 / 100
3 ms 212 KB
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
const int MAXN = 55;
void speed()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int n, m;
int a[MAXN][MAXN];

void read()
{
    cin >> n >> m;
    for (int i = 1; i <= n; ++ i)
    {
        for (int j = 1; j <= m; ++ j)
            cin >> a[i][j];
    }
}

void solve()
{
    int ans = 0;
    for (int i = 1; i <= n; ++ i)
    {
        for (int j = 1; j <= m; ++ j)
        {
            for (int x = 1; x <= n; ++ x)
            {
                for (int y = 1; y <= m; ++ y)
                {
                    int maxx = max(a[i][j], a[x][y]);
                    int minn = min(a[i][j], a[x][y]);
                    int s = abs(x - i) + abs(y - j) + 1;
                    ///cout << i << " " << j << ", " << x << ", " << y << " -> " <<  maxx - minn - s << endl;
                    ans = max(ans, maxx - minn - s);
                }
            }
        }
    }
    cout << ans << endl;
}
int main()
{
    speed();

    read();
    solve();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 212 KB Output is correct
2 Correct 3 ms 212 KB Output is correct
3 Correct 3 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -