結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
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 3 ms
5,376 KB
testcase_13 AC 4 ms
5,376 KB
testcase_14 AC 4 ms
5,376 KB
testcase_15 AC 12 ms
7,936 KB
testcase_16 AC 14 ms
9,088 KB
testcase_17 AC 132 ms
30,976 KB
testcase_18 AC 220 ms
47,364 KB
testcase_19 AC 151 ms
12,416 KB
testcase_20 AC 218 ms
47,488 KB
testcase_21 AC 211 ms
47,488 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 || j == 0){
                dist[i][j] = 1;
                continue;
            }
            int mini = INF;
            for(int k = 0;k < 3;k++)if(j+dx[k] < W && i+dy[k] < H)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