이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#define int long long
using namespace std;
int a[1005][1005];
signed main()
{
int n, m;
cin>>n>>m;
for(int i = 1; i <= n; i++)
for(int j = 1; j <= m; j++)
cin>>a[i][j];
int maxx = -1;
for(int i1 = 1; i1 <= n; i1++)
{
for(int j1 = 1; j1 <= m; j1++)
{
for(int i2 = 1; i2 <= n; i2++)
{
for(int j2 = 1; j2 <= m; j2++)
{
if(i1 != j1 || i2 != j2)
{
int n1, n2, n3;
n1 = max(a[i1][j1], a[i2][j2]);
n2 = min(a[i1][j1], a[i2][j2]);
n3 = (abs(i1 - i2) + abs(j1 - j2) + 1);
maxx = max((n1 - n2 - n3), maxx);
}
}
}
}
}
cout<<maxx<<'\n';
return 0;
}
# | 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... |