Submission #674175

# Submission time Handle Problem Language Result Execution time Memory
674175 2022-12-23T11:25:16 Z QwertyPi Maxcomp (info1cup18_maxcomp) C++14
0 / 100
2 ms 212 KB
#include <bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define pii pair<int, int>
using namespace std;

const int MOD = 1e9 + 7;
const int MAXN = 1e5 + 11;
const int B = 800;

int a[51][51];
int32_t main(){
	int n, m; cin >> n >> m;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			cin >> a[i][j];
		}
	}

	int ans = 0;
	for(int x1 = 0; x1 < n; x1++){
		for(int y1 = 0; y1 < m; y1++){
			for(int x2 = 0; x2 < n; x2++){
				for(int y2 = 0; y2 < n; y2++){
					int s = abs(x1 - x2) + abs(y1 - y2) + 1;
					int mx = a[x1][y1], mn = a[x1][y1];
					for(int i = min(x1, x2); i <= max(x1, x2); i++){
						mx = max(mx, a[i][y1]);
						mn = min(mn, a[i][y1]);
					}
					for(int i = min(y1, y2); i <= max(y1, y2); i++){
						mx = max(mx, a[x2][i]);
						mn = min(mn, a[x2][i]);
					}
					ans = max(ans, mx - mn - s);
				}
			}
		}
	}
	cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -