結果
| 問題 | No.402 最も海から遠い場所 |
| コンテスト | |
| ユーザー |
y_mazun
|
| 提出日時 | 2017-01-20 15:49:29 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 52 ms / 3,000 ms |
| コード長 | 875 bytes |
| 記録 | |
| コンパイル時間 | 573 ms |
| コンパイル使用メモリ | 87,600 KB |
| 実行使用メモリ | 48,024 KB |
| 最終ジャッジ日時 | 2026-05-29 05:49:28 |
| 合計ジャッジ時間 | 1,946 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 |
ソースコード
#include <iostream>
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#include <cstring>
#include <queue>
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }
#include <set>
using namespace std;
int d[3010][3010];
char g[3010][3010];
inline int get(int x, int y, int w, int h) {
return ISIN(x, y, w, h) ? d[y][x] : 0;
}
int main(){
const int h = getInt();
const int w = getInt();
REP(i,h) scanf("%s", g[i]);
int ans = 0;
REP(i,h) REP(j,w) {
if (g[i][j] == '.') d[i][j] = 0;
else d[i][j] = min(get(j - 1, i, w, h),
min(get(j, i - 1, w, h),
get(j - 1, i - 1, w, h))) + 1;
ans = max(ans, d[i][j]);
}
// REP(i,h) { REP(j,w) printf("%02d ", d[i][j]); puts(""); }
printf("%d\n", (ans + 1) / 2);
return 0;
}
y_mazun