結果
問題 | No.402 最も海から遠い場所 |
ユーザー |
![]() |
提出日時 | 2018-11-07 20:39:48 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 203 ms / 3,000 ms |
コード長 | 681 bytes |
コンパイル時間 | 1,723 ms |
コンパイル使用メモリ | 196,192 KB |
最終ジャッジ日時 | 2025-01-06 15:51:20 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
#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 HEREconst 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;}