結果

問題 No.402 最も海から遠い場所
ユーザー msm1993msm1993
提出日時 2021-03-23 15:31:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 191 ms / 3,000 ms
コード長 574 bytes
コンパイル時間 1,305 ms
コンパイル使用メモリ 166,448 KB
実行使用メモリ 56,140 KB
最終ジャッジ日時 2023-08-16 17:41:11
合計ジャッジ時間 4,593 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 3 ms
4,380 KB
testcase_14 AC 2 ms
4,704 KB
testcase_15 AC 9 ms
6,768 KB
testcase_16 AC 11 ms
7,840 KB
testcase_17 AC 114 ms
34,180 KB
testcase_18 AC 185 ms
56,140 KB
testcase_19 AC 168 ms
20,992 KB
testcase_20 AC 187 ms
56,108 KB
testcase_21 AC 191 ms
56,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

const short inf = 3e4;

int h, w;
int a[3002][3002];
string s[3002];
int main() {
  cin >> h >> w;
  s[0] = string(w + 2, '.');
  s[h + 1] = string(w + 2, '.');
  for (int i = 0; i < h; ++i) {
    string t;
    cin >> t;
    s[i + 1] = '.' + t + '.';
  }
  
  int mx = 0;
  for (int i = 1; i <= h; ++i) {
    for (int j = 1; j <= w; ++j) {
      if (s[i][j] == '#') {
        a[i][j] = min({ a[i - 1][j - 1], a[i - 1][j], a[i][j - 1] }) + 1;
        mx = max(mx, a[i][j]);
      }
    }
  }
  
  cout << (mx + 1) / 2 << endl;
}
0