結果

問題 No.402 最も海から遠い場所
ユーザー AquariusAquarius
提出日時 2019-10-15 16:22:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 217 ms / 3,000 ms
コード長 574 bytes
コンパイル時間 1,447 ms
コンパイル使用メモリ 167,688 KB
実行使用メモリ 56,188 KB
最終ジャッジ日時 2023-08-28 15:08:44
合計ジャッジ時間 3,812 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 3 ms
4,380 KB
testcase_14 AC 3 ms
4,788 KB
testcase_15 AC 10 ms
7,100 KB
testcase_16 AC 13 ms
7,892 KB
testcase_17 AC 131 ms
34,236 KB
testcase_18 AC 211 ms
56,120 KB
testcase_19 AC 192 ms
20,912 KB
testcase_20 AC 210 ms
56,128 KB
testcase_21 AC 217 ms
56,188 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