답안 #317003

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
317003 2020-10-29T00:49:20 Z Kevin_Zhang_TW Maxcomp (info1cup18_maxcomp) C++17
60 / 100
500 ms 8264 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 = -1;
	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';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 18 ms 512 KB Output is correct
10 Correct 15 ms 632 KB Output is correct
11 Correct 15 ms 512 KB Output is correct
12 Correct 15 ms 512 KB Output is correct
13 Correct 17 ms 512 KB Output is correct
14 Correct 15 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 18 ms 512 KB Output is correct
13 Correct 15 ms 632 KB Output is correct
14 Correct 15 ms 512 KB Output is correct
15 Correct 15 ms 512 KB Output is correct
16 Correct 17 ms 512 KB Output is correct
17 Correct 15 ms 512 KB Output is correct
18 Execution timed out 1079 ms 8264 KB Time limit exceeded
19 Halted 0 ms 0 KB -