結果

問題 No.402 最も海から遠い場所
ユーザー BantakoBantako
提出日時 2017-08-24 14:57:13
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 771 bytes
コンパイル時間 1,713 ms
コンパイル使用メモリ 163,868 KB
実行使用メモリ 47,616 KB
最終ジャッジ日時 2024-04-23 14:11:07
合計ジャッジ時間 4,844 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 WA -
testcase_02 AC 2 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 4 ms
5,376 KB
testcase_14 AC 4 ms
5,376 KB
testcase_15 AC 11 ms
7,936 KB
testcase_16 AC 15 ms
8,960 KB
testcase_17 AC 134 ms
31,232 KB
testcase_18 AC 240 ms
47,616 KB
testcase_19 AC 170 ms
12,416 KB
testcase_20 AC 255 ms
47,360 KB
testcase_21 AC 218 ms
47,428 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:9:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    9 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1e9;
int MOD = 1e9+7;
int dist[3000][3000];
char S[3000][3000];
int H,W;
main(){
    cin >> H >> W;
    for(int i = 0;i < H;i++){
        cin >> S[i];
    }
    int dx[] = {-1, 0, -1};
    int dy[] = {-1,-1, 0};
    int maxi = 0;
    for(int i = 0;i < H;i++){
        for(int j = 0;j < W;j++){
            if(S[i][j] == '.')continue;
            if(i == 0 || i == H-1 || j == 0 || j == W-1){
                dist[i][j] = 1;
                continue;
            }
            int mini = INF;
            for(int k = 0;k < 3;k++)mini = min(mini,dist[ i+dy[k] ][ j+dx[k] ]);
            dist[i][j] = mini + 1;
            maxi = max(maxi,mini+1);
        }
    }
    cout << (maxi+1)/2 << endl;
}
0