답안 #536156

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
536156 2022-03-12T14:16:12 Z cig32 Maxcomp (info1cup18_maxcomp) C++17
15 / 100
2 ms 340 KB
#include "bits/stdc++.h"
using namespace std;
const int MAXN = 2e5 + 10;
const int MOD = 1e9 + 7;
#define int long long
mt19937_64 rng((int)std::chrono::steady_clock::now().time_since_epoch().count());
int rnd(int x, int y) {
  int u = uniform_int_distribution<int>(x, y)(rng); return u;
}

void solve(int tc) {
  int n, m;
  cin >> n >> m;
  int a[n+1][m+1];
  for(int i=1; i<=n; i++) {
    for(int j=1; j<=m; j++) {
      cin >> a[i][j];
    }
  }
  int ans = 0;
  for(int i=1; i<=n; i++) {
    for(int j=1; j<=m; j++) {
      for(int k=1; k<=n; k++) {
        for(int l=1; l<=m; l++) {
          ans = max(ans, abs(a[i][j] - a[k][l]) - (abs(i - k) + abs(j - l) + 1));
        }
      }
    }
  }
  cout << ans << "\n";
}

int32_t main(){
  ios::sync_with_stdio(0); cin.tie(0);
  int t = 1; //cin >> t;
  for(int i=1; i<=t; i++) solve(i);
} 
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -