이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define NM 1002
using namespace std;
int n, m;
int ma[NM][NM];
int mx = -1;
int dist(int a1, int a2, int b1, int b2)
{
return abs(a2 - a1 + 1) + abs(b2 - b1 + 1) + 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 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(abs(ma[i1][j1] - ma[i2][j2]) - dist(i1, j1, i2, j2) > mx)
mx = abs(ma[i1][j1] - ma[i2][j2]) - dist(i1, j1, i2, j2);
cout << mx << "\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... |