# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
47238 | PowerOfNinjaGo | Maxcomp (info1cup18_maxcomp) | C++17 | 1065 ms | 13316 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//Power Of Ninja Go
#include <bits/stdc++.h>
//#ifdef atom #else #endif
using namespace std;
typedef long long ll; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector< ii > vii;
#define X first
#define Y second
#define pb push_back
const int maxn = 1e3+5;
int arr[maxn][maxn];
int main()
{
int n, m; scanf("%d %d", &n, &m);
for(int i = 1; i<= n; i++)
{
for(int j = 1; j<= m; j++)
{
scanf("%d", arr[i]+j);
}
}
ll best = -1e18;
for(int i = 1; i<= n; i++)
{
for(int j = 1; j<= m; j++)
{
for(int i2 = 1; i2<= n; i2++)
{
for(int j2 = 1; j2<= m; j2++)
{
best = max(best, -1LL*abs(i-i2)-abs(j-j2)-1+abs(arr[i][j]-arr[i2][j2]));
}
}
}
}
cout << best << endl;
}
Compilation message (stderr)
# | 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... |