Submission #1171326

#TimeUsernameProblemLanguageResultExecution timeMemory
1171326lopkusMaxcomp (info1cup18_maxcomp)C++20
0 / 100
1 ms356 KiB
#include <bits/stdc++.h> int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n, m; std::cin >> n >> m; std::vector<std::vector<int64_t>> a(n + 1, std::vector<int64_t>(m + 1)); for(int i = 1; i <= n; i++) { for(int j = 1; j <= m; j++) { std::cin >> a[i][j]; } } int64_t ans = 0; for(int x = 1; x <= n; x++) { for(int y = 1; y <= m; y++) { for(int x1 = x + 1; x1 <= n; x1++) { for(int y1 = y + 1; y1 <= m; y1++) { int64_t cost = std::max(a[x][y], a[x1][y1]) - std::min(a[x][y], a[x1][y1]); int path = abs(x - x1) + abs(y - y1) + 1; ans = std::max(ans, cost - path); } } } } std::cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...