結果
問題 | No.402 最も海から遠い場所 |
ユーザー |
![]() |
提出日時 | 2021-03-23 15:31:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 241 ms / 3,000 ms |
コード長 | 574 bytes |
コンパイル時間 | 1,511 ms |
コンパイル使用メモリ | 170,492 KB |
実行使用メモリ | 56,156 KB |
最終ジャッジ日時 | 2024-11-25 07:18:26 |
合計ジャッジ時間 | 4,455 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
#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; }