Submission #523625

# Submission time Handle Problem Language Result Execution time Memory
523625 2022-02-08T01:52:28 Z maks007 Maxcomp (info1cup18_maxcomp) C++14
0 / 100
1 ms 332 KB
#include <bits/stdc++.h>

using namespace std;

int main(void) {
	int n, m;
	cin >> n >> m;
	vector <vector <int>> g(n+2, vector <int> (m+2, -1));
	int mx = -1e9;
	int mn = 1e9;
	pair <int,int> mxid, mnid;
	for(int i = 1; i <= n; i ++) {
		for(int j = 1; j <= m; j ++) {
			cin >> g[i][j];
			if(g[i][j] > mx) {
				mx = g[i][j];
				mxid = {i, j};
			}
			if(g[i][j] < mn) {
				mn = g[i][j];
				mnid = {i, j};
			}
		}
	}
	cout << mx - mn - (abs(mnid.first - mxid.first) + abs(mxid.second - mnid.second) + 1);
	return false;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 288 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 1 ms 332 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 288 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 1 ms 332 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 288 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 1 ms 332 KB Output isn't correct
5 Halted 0 ms 0 KB -