답안 #44701

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
44701 2018-04-05T03:04:49 Z admin Maxcomp (info1cup18_maxcomp) C++17
45 / 100
3 ms 1056 KB
#include <bits/stdc++.h>

using namespace std;

const int N_ = 1050, M_ = 1050;

int N, M, A[N_][M_];

int ans = -int(1e9);

void go() {
  vector< vector<int> > mn(N+1, vector<int>(M+1, int(1e9)+1));
  vector< vector<int> > mx(N+1, vector<int>(M+1, -1));
  for(int i = 1; i <= N; i++) {
    for(int j = 1; j <= M; j++) {
      int cur_min = min(mn[i][j-1], mn[i-1][j]);
      int cur_max = max(mx[i][j-1], mx[i-1][j]);
      ans = max(ans, max(A[i][j] - cur_min, -A[i][j] + cur_max) - (i + j) - 1);
      mn[i][j] = min(cur_min, A[i][j] - (i + j));
      mx[i][j] = max(cur_max, A[i][j] + (i + j));
    }
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin >> N >> M;
  for(int i = 1; i <= N; i++) {
    for(int j = 1; j <= M; j++) {
      cin >> A[i][j];
    }
  }

  assert(max(N,M) <= 50);
  go();
  for(int i = 1; i <= N; i++) {
    reverse(A[i]+1, A[i]+M+1);
  }
  go();

  cout << ans << endl;
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 536 KB Output is correct
4 Correct 2 ms 536 KB Output is correct
5 Correct 2 ms 536 KB Output is correct
6 Correct 2 ms 536 KB Output is correct
7 Correct 2 ms 536 KB Output is correct
8 Correct 2 ms 560 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 688 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 536 KB Output is correct
4 Correct 2 ms 536 KB Output is correct
5 Correct 2 ms 536 KB Output is correct
6 Correct 2 ms 536 KB Output is correct
7 Correct 2 ms 536 KB Output is correct
8 Correct 2 ms 560 KB Output is correct
9 Correct 2 ms 1024 KB Output is correct
10 Correct 2 ms 1036 KB Output is correct
11 Correct 2 ms 1056 KB Output is correct
12 Correct 3 ms 1056 KB Output is correct
13 Correct 2 ms 1056 KB Output is correct
14 Correct 2 ms 1056 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 536 KB Output is correct
4 Correct 2 ms 536 KB Output is correct
5 Correct 2 ms 536 KB Output is correct
6 Correct 2 ms 536 KB Output is correct
7 Correct 2 ms 536 KB Output is correct
8 Correct 2 ms 560 KB Output is correct
9 Runtime error 3 ms 688 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Halted 0 ms 0 KB -