답안 #410707

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
410707 2021-05-23T12:16:34 Z nichke Maxcomp (info1cup18_maxcomp) C++14
60 / 100
500 ms 20284 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'

int n, m, ans = -2;
int ar[3005][3005];

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> ar[i][j];
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			for (int k = 0; k < n; k++) {
				for (int l = 0; l < m; l++) {
					int tmp = max(ar[i][j], ar[k][l]) - min(ar[i][j], ar[k][l]);
					if (i == k && j == l) {
						tmp--;
					} else if (i == k) {
						tmp -= abs(j - l) + 1;
					} else if (j == l) {
						tmp -= abs(i - k) + 1;
					} else {
						tmp -= abs(i - k) + abs(j - l) + 1;
					}
					ans = max(ans, tmp);
				}
			}
		}
	}
	cout << ans << '\n';
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 204 KB Output is correct
2 Correct 6 ms 204 KB Output is correct
3 Correct 6 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 35 ms 460 KB Output is correct
10 Correct 30 ms 460 KB Output is correct
11 Correct 30 ms 460 KB Output is correct
12 Correct 29 ms 460 KB Output is correct
13 Correct 30 ms 580 KB Output is correct
14 Correct 36 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 6 ms 204 KB Output is correct
10 Correct 6 ms 204 KB Output is correct
11 Correct 6 ms 332 KB Output is correct
12 Correct 35 ms 460 KB Output is correct
13 Correct 30 ms 460 KB Output is correct
14 Correct 30 ms 460 KB Output is correct
15 Correct 29 ms 460 KB Output is correct
16 Correct 30 ms 580 KB Output is correct
17 Correct 36 ms 460 KB Output is correct
18 Execution timed out 1086 ms 20284 KB Time limit exceeded
19 Halted 0 ms 0 KB -