Submission #197221

#TimeUsernameProblemLanguageResultExecution timeMemory
197221_TimeLord_Maxcomp (info1cup18_maxcomp)C++17
0 / 100
6 ms380 KiB
#include <bits/stdc++.h>

using namespace std;
using namespace chrono;
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("tune=native, sse, sse2, ssse3, sse4")
#pragma GCC optimize("unroll-loops")
*/

typedef long long ll;
typedef long double ld;

#define fs first
#define sc second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define maxn 200000
#define BIG 1000000000000000000

mt19937 rnd(42);

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    auto st = steady_clock().now();
    int n, m;
    cin >> n >> m;
    vector<vector<int> > a(n, vector<int>(m));
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++)
            cin >> a[i][j];
    }
    int ans = -1e9;
    for(int o1 = 0; o1 < n; o1++)
        for(int o2 = 0; o2 < m; o2++){
            int p1 = a[o1][o2];
            for(int i = 0; i < n; i++)
                for(int j = 0; j < m; j++){
                    int p2 = a[i][j];
                    ans = max(ans, max(p1, p2) - min(p1, p2) - abs(i - o1) - abs(o2 - j));
                }
            }
    cout << ans;

}

Compilation message (stderr)

maxcomp.cpp: In function 'int main()':
maxcomp.cpp:30:10: warning: variable 'st' set but not used [-Wunused-but-set-variable]
     auto st = steady_clock().now();
          ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...