結果
| 問題 |
No.402 最も海から遠い場所
|
| コンテスト | |
| ユーザー |
nmnmnmnmnmnmnm
|
| 提出日時 | 2016-07-22 23:15:44 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,726 bytes |
| コンパイル時間 | 868 ms |
| コンパイル使用メモリ | 93,584 KB |
| 実行使用メモリ | 82,668 KB |
| 最終ジャッジ日時 | 2024-11-06 13:07:51 |
| 合計ジャッジ時間 | 5,147 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 WA * 2 |
ソースコード
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <list>
using namespace std;
typedef long long ll;
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define along long(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(d) string(1,d)
#define print(x) cout<<#x<<" = "<<x<<endl;
#define MOD 1000000007
ll d[3003][3003];
int f(int y, int x) {
if (y < 0 || x < 0)return 0;
return d[y][x];
}
int main() {
ll h, w;
cin >> h >> w;
vector<string> v;
rep(i, 0, h) {
string s;
cin >> s;
v.pb(s);
}
clr(d, 0);
rep(y, 0, h) {
rep(x, 0, w) {
if (v[y][x] == '#') {
d[y][x] = 1;
}
}
}
rep(y, 0, h) {
rep(x, 1, w) {
d[y][x] += d[y][x - 1];
}
}
rep(y, 1, h) {
rep(x, 0, w) {
d[y][x] += d[y - 1][x];
}
}
ll mx = 0;
rep(y, 0, h) {
rep(x, 0, w) {
long long low = 0;
long long high = 60;
while (low < high) {
long long mid = (high + low + 1) >> 1;
ll count;
count = f(y, x) - f(y - mid - 1, x) - f(y, x - mid - 1) + f(y - mid - 1, x - mid - 1);
if (count == (mid + 1) * (mid + 1)) {
low = mid;
}
else {
high = mid - 1;
}
}
mx = max(mx, (low + 2) / 2);
}
}
cout << mx << endl;
return 0;
}
nmnmnmnmnmnmnm