結果

問題 No.402 最も海から遠い場所
コンテスト
ユーザー AreTrash
提出日時 2016-07-21 01:07:43
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 72 ms / 3,000 ms
コード長 531 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 503 ms
コンパイル使用メモリ 74,884 KB
実行使用メモリ 39,168 KB
最終ジャッジ日時 2026-05-06 14:08:54
合計ジャッジ時間 1,970 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;

int H, W;
int dp[3010][3010] = { 0 };
char c[3010];

int main(void)
{
    cin >> H >> W;

    int res = 0;
    for (int i = 1; i <= H; i++) {
        scanf("%s", c);
        for (int j = 1; j <= W; j++) {
            if (c[j - 1] == '#'){
                dp[i][j] = min(dp[i - 1][j - 1], min(dp[i - 1][j], dp[i][j - 1])) + 1;
                res = max(res, dp[i][j]);
            }
        }
    }

    cout << (res + 1) / 2 << endl;
    return 0;
}
0