Submission #645001

#TimeUsernameProblemLanguageResultExecution timeMemory
645001notmeMaxcomp (info1cup18_maxcomp)C++14
15 / 100
3 ms212 KiB
#include<bits/stdc++.h> #define endl '\n' using namespace std; const int MAXN = 55; void speed() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int n, m; int a[MAXN][MAXN]; void read() { cin >> n >> m; for (int i = 1; i <= n; ++ i) { for (int j = 1; j <= m; ++ j) cin >> a[i][j]; } } void solve() { int ans = 0; for (int i = 1; i <= n; ++ i) { for (int j = 1; j <= m; ++ j) { for (int x = 1; x <= n; ++ x) { for (int y = 1; y <= m; ++ y) { int maxx = max(a[i][j], a[x][y]); int minn = min(a[i][j], a[x][y]); int s = abs(x - i) + abs(y - j) + 1; ///cout << i << " " << j << ", " << x << ", " << y << " -> " << maxx - minn - s << endl; ans = max(ans, maxx - minn - s); } } } } cout << ans << endl; } int main() { speed(); read(); solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...