This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
int n, m;
cin >> n >> m;
int a[3000][3000];
for(int i = 1; i <= n; i++)
{
for(int j = 1; j <= m; j++)
{
cin >> a[i][j];
}
}
int mx = -INT_MAX;
for(int i = 1; i <= n; i++)
{
for(int j = 1; j <= m; j++)
{
for(int r = 1; r <= n; r++)
{
for(int k = 1; k <= m; k++)
{
mx = max(mx, a[i][j] - a[r][k] - abs(i - r) - abs(j - k) - 1);
}
}
}
}
cout << mx;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |