結果

問題 No.402 最も海から遠い場所
ユーザー pekempey
提出日時 2016-11-22 18:29:23
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 70 ms / 3,000 ms
コード長 717 bytes
コンパイル時間 2,326 ms
コンパイル使用メモリ 178,092 KB
実行使用メモリ 29,824 KB
最終ジャッジ日時 2024-11-27 09:41:14
合計ジャッジ時間 3,728 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include <bits/stdc++.h>
using namespace std;
#define getchar getchar_unlocked

short h, w, dp[3001][3001];
char g[3001][3002];

void get_str(char *s) {
    int c, len = 0;
    while ((c = getchar()) < '!') if (c == EOF) abort();
    s[len++] = c;
    while ((c = getchar()) >= '!') s[len++] = c;
    s[len] = '\0';
}

int main() {
    cin >> h >> w;
    for (int i = 1; i <= h; i++) get_str(g[i] + 1);
    short ans = 0;
    for (int i = 1; i <= h; i++) for (int j = 1; j <= w; j++) {
        dp[i][j] = g[i][j] == '.' ? 0 : min({ dp[i - 1][j], dp[i][j - 1], dp[i - 1][j - 1] }) + 1;
        ans = max(ans, dp[i][j]);
    }
    cout << (ans + 1) / 2 << endl;
}
0