結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 3 ms
6,944 KB
testcase_05 AC 3 ms
6,944 KB
testcase_06 AC 3 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 3 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 3 ms
6,940 KB
testcase_12 AC 3 ms
6,940 KB
testcase_13 AC 4 ms
6,940 KB
testcase_14 AC 3 ms
8,296 KB
testcase_15 AC 11 ms
7,936 KB
testcase_16 AC 14 ms
9,088 KB
testcase_17 AC 125 ms
31,232 KB
testcase_18 AC 231 ms
47,516 KB
testcase_19 AC 172 ms
12,416 KB
testcase_20 AC 247 ms
47,488 KB
testcase_21 AC 214 ms
47,580 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 = 1;
    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