結果
問題 | No.402 最も海から遠い場所 |
ユーザー |
|
提出日時 | 2016-11-20 01:49:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 515 ms / 3,000 ms |
コード長 | 437 bytes |
コンパイル時間 | 563 ms |
コンパイル使用メモリ | 67,696 KB |
実行使用メモリ | 73,880 KB |
最終ジャッジ日時 | 2024-11-27 06:35:28 |
合計ジャッジ時間 | 4,313 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
#include<iostream>#include<algorithm>using namespace std;const int M=3000;int main(){int h,w;cin>>h>>w;int c[M+1][M+1],dp[M+1][M+1]={};char a;for(int i=1;i<=h;i++)for(int j=1;j<=w;j++){cin>>a;c[i][j]=(a=='#'?0:1);}int ma=0;for(int i=1;i<=h;i++){for(int j=1;j<=w;j++){if(!c[i][j])dp[i][j]=min(dp[i][j-1],min(dp[i-1][j-1],dp[i-1][j]))+1,ma=max(ma,dp[i][j]);}}cout<<(ma+1)/2<<endl;return 0;}