Submission #316999

# Submission time Handle Problem Language Result Execution time Memory
316999 2020-10-29T00:47:30 Z Kevin_Zhang_TW Maxcomp (info1cup18_maxcomp) C++17
15 / 100
3 ms 512 KB
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define AI(i) begin(i), end(i)
#define pb emplace_back

#ifdef KEV
#define DE(args...) kout("[ " + string(#args) + " ] : ", args)
void kout() { cerr << endl; }
template<class T, class ...U>
void kout(T a, U ...b) { cerr << a << ' ', kout(b...); }
void debug(auto L, auto R) { while (L != R) cerr << *L << " \n"[next(L) == R], ++L; }
#else
#define DE(...) 0
#define debug(...) 0
#endif
const int MAX_N = 1010, inf = 1e9;
int n, m;
ll a[MAX_N][MAX_N];

ll solve() {
	ll res = 0;
	for (int i = 1;i <= n;++i)
		for (int j = 1;j <= m;++j)
			for (int k = 1;k <= n;++k)
				for (int l = 1;l <= m;++l) 
					res = max(res, -(abs(i-k) + abs(j-l) + 1) + abs(a[i][j] - a[k][l]));
	return res;


}
int32_t main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> n >> m;
	for (int i = 1;i <= n;++i)
		for (int j = 1;j <= m;++j)
			cin >> a[i][j];
	cout << solve() << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Incorrect 1 ms 512 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Incorrect 1 ms 512 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Incorrect 1 ms 512 KB Output isn't correct
4 Halted 0 ms 0 KB -