답안 #645002

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
645002 2022-09-25T19:19:11 Z notme Maxcomp (info1cup18_maxcomp) C++14
60 / 100
23 ms 980 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 = -1;
    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 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 320 KB Output is correct
# 결과 실행 시간 메모리 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 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 320 KB Output is correct
9 Correct 23 ms 340 KB Output is correct
10 Correct 16 ms 356 KB Output is correct
11 Correct 16 ms 340 KB Output is correct
12 Correct 19 ms 332 KB Output is correct
13 Correct 16 ms 340 KB Output is correct
14 Correct 22 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 320 KB Output is correct
9 Correct 3 ms 212 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
11 Correct 3 ms 212 KB Output is correct
12 Correct 23 ms 340 KB Output is correct
13 Correct 16 ms 356 KB Output is correct
14 Correct 16 ms 340 KB Output is correct
15 Correct 19 ms 332 KB Output is correct
16 Correct 16 ms 340 KB Output is correct
17 Correct 22 ms 340 KB Output is correct
18 Runtime error 4 ms 980 KB Execution killed with signal 11
19 Halted 0 ms 0 KB -