結果

問題 No.402 最も海から遠い場所
ユーザー beetbeet
提出日時 2018-11-07 20:39:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 217 ms / 3,000 ms
コード長 681 bytes
コンパイル時間 1,941 ms
コンパイル使用メモリ 202,992 KB
実行使用メモリ 50,816 KB
最終ジャッジ日時 2024-04-30 22:32:40
合計ジャッジ時間 5,489 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
39,272 KB
testcase_01 AC 13 ms
39,296 KB
testcase_02 AC 12 ms
39,308 KB
testcase_03 AC 14 ms
39,288 KB
testcase_04 AC 13 ms
39,424 KB
testcase_05 AC 13 ms
39,296 KB
testcase_06 AC 13 ms
39,296 KB
testcase_07 AC 12 ms
39,296 KB
testcase_08 AC 12 ms
39,296 KB
testcase_09 AC 13 ms
39,168 KB
testcase_10 AC 13 ms
39,424 KB
testcase_11 AC 11 ms
39,400 KB
testcase_12 AC 13 ms
39,304 KB
testcase_13 AC 14 ms
39,424 KB
testcase_14 AC 13 ms
39,408 KB
testcase_15 AC 19 ms
39,680 KB
testcase_16 AC 22 ms
39,928 KB
testcase_17 AC 129 ms
46,544 KB
testcase_18 AC 217 ms
50,744 KB
testcase_19 AC 201 ms
50,816 KB
testcase_20 AC 214 ms
50,736 KB
testcase_21 AC 201 ms
50,560 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