結果

問題 No.402 最も海から遠い場所
ユーザー beetbeet
提出日時 2018-11-07 20:39:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 206 ms / 3,000 ms
コード長 681 bytes
コンパイル時間 2,678 ms
コンパイル使用メモリ 201,448 KB
実行使用メモリ 50,652 KB
最終ジャッジ日時 2023-08-13 04:09:37
合計ジャッジ時間 5,189 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
39,252 KB
testcase_01 AC 12 ms
39,256 KB
testcase_02 AC 12 ms
39,148 KB
testcase_03 AC 12 ms
39,144 KB
testcase_04 AC 11 ms
39,192 KB
testcase_05 AC 12 ms
39,144 KB
testcase_06 AC 11 ms
39,448 KB
testcase_07 AC 12 ms
39,196 KB
testcase_08 AC 12 ms
39,312 KB
testcase_09 AC 11 ms
39,256 KB
testcase_10 AC 12 ms
39,136 KB
testcase_11 AC 11 ms
39,208 KB
testcase_12 AC 11 ms
39,260 KB
testcase_13 AC 13 ms
39,280 KB
testcase_14 AC 12 ms
39,364 KB
testcase_15 AC 18 ms
39,440 KB
testcase_16 AC 19 ms
39,736 KB
testcase_17 AC 120 ms
46,380 KB
testcase_18 AC 206 ms
50,652 KB
testcase_19 AC 186 ms
50,596 KB
testcase_20 AC 206 ms
50,636 KB
testcase_21 AC 190 ms
50,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
const int MAX = 3030;
int dp[MAX][MAX];
signed main(){
  int h,w;
  cin>>h>>w;
  vector<string> s(h);
  for(int i=0;i<h;i++) cin>>s[i];

  memset(dp,0,sizeof(dp));
  for(int i=h-1;i>=0;i--)
    for(int j=w-1;j>=0;j--)
      if(s[i][j]=='#')
        dp[i][j]=min({dp[i+1][j],dp[i][j+1],dp[i+1][j+1]})+1;  
  
  int ans=0;
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++)
      chmax(ans,dp[i][j]);

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