Submission #1100227

# Submission time Handle Problem Language Result Execution time Memory
1100227 2024-10-13T10:18:21 Z vjudge1 Maxcomp (info1cup18_maxcomp) C++17
0 / 100
1 ms 508 KB
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define all(x) x.begin(), x.end()

const int N = 1001;

using namespace std;

ll n, m, k, a, b, p[N][N];

signed main (){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for (int i = 1; i <= n; i++){
		for (int y = 1; y <= m; y++){
			cin >> p[i][y];
			a = max (a, p[i][y]);
		}
	}
	b = -1;
	for (int i = 1; i <= n; i++){
		for (int y = 1; y <= m; y++){
			if (p[i][y] == a){
				for (int j = 1; j <= n; j++){
					for (int k = 1; k <= m; k++){
						b = max (p[i][y] - p[j][k] - (abs (i - j) + abs (y - k) + 1), b);
//						cout << p[i][y] - p[j][k] - (abs (i - j) + abs (y - k) + 1) << ' ' << j << ' ' << k << ' ' << i << ' ' << y << '\n';
					}
				}
			}
		}
	}
	cout << b;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Incorrect 1 ms 336 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 508 KB Output is correct
3 Incorrect 1 ms 336 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Incorrect 1 ms 336 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Incorrect 1 ms 336 KB Output isn't correct
5 Halted 0 ms 0 KB -