Submission #523714

# Submission time Handle Problem Language Result Execution time Memory
523714 2022-02-08T04:51:02 Z maks007 Maxcomp (info1cup18_maxcomp) C++14
60 / 100
500 ms 12676 KB
#include <bits/stdc++.h>
 
using namespace std;
 
int dis(pair <int,int>a, pair <int,int> b) {
	return abs(a.first - b.first) + abs(a.second - b.second);
}
 
int main(void) {
	int n, m;
	cin >> n >> m;
	
	vector <vector <int> > g(n, vector <int> (m));
	
	
	for(int i  = 0; i < n; i ++) {
		for(int j = 0; j < m; j ++) cin >> g[i][j];
	}

	int ans = -1e9;
 
	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 ++) {

					ans = max(ans, g[i][j] - g[k][l] - (abs(i-k)+abs(j-l)+1));
				}
			}
		}
	}
	cout << ans;
	return false;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 292 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 292 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 292 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 292 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 9 ms 316 KB Output is correct
10 Correct 15 ms 204 KB Output is correct
11 Correct 11 ms 204 KB Output is correct
12 Correct 10 ms 204 KB Output is correct
13 Correct 10 ms 324 KB Output is correct
14 Correct 9 ms 296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 292 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 292 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Correct 2 ms 204 KB Output is correct
12 Correct 9 ms 316 KB Output is correct
13 Correct 15 ms 204 KB Output is correct
14 Correct 11 ms 204 KB Output is correct
15 Correct 10 ms 204 KB Output is correct
16 Correct 10 ms 324 KB Output is correct
17 Correct 9 ms 296 KB Output is correct
18 Execution timed out 1010 ms 12676 KB Time limit exceeded
19 Halted 0 ms 0 KB -