Submission #684736

#TimeUsernameProblemLanguageResultExecution timeMemory
684736heeheeheehaawMaxcomp (info1cup18_maxcomp)C++17
15 / 100
4 ms312 KiB
#include <iostream> #define int long long using namespace std; int a[1005][1005]; signed main() { int n, m; cin>>n>>m; for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) cin>>a[i][j]; int maxx = -1; for(int i1 = 1; i1 <= n; i1++) { for(int j1 = 1; j1 <= m; j1++) { for(int i2 = 1; i2 <= n; i2++) { for(int j2 = 1; j2 <= m; j2++) { if(i1 != j1 || i2 != j2) { int n1, n2, n3; n1 = max(a[i1][j1], a[i2][j2]); n2 = min(a[i1][j1], a[i2][j2]); n3 = (abs(i1 - i2) + abs(j1 - j2) + 1); maxx = max((n1 - n2 - n3), maxx); } } } } } cout<<maxx<<'\n'; 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...