結果

問題 No.402 最も海から遠い場所
ユーザー BantakoBantako
提出日時 2017-08-24 15:03:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 232 ms / 3,000 ms
コード長 777 bytes
コンパイル時間 1,489 ms
コンパイル使用メモリ 165,040 KB
実行使用メモリ 47,284 KB
最終ジャッジ日時 2023-08-05 17:16:02
合計ジャッジ時間 3,887 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,440 KB
testcase_01 AC 2 ms
5,396 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
5,676 KB
testcase_04 AC 2 ms
5,384 KB
testcase_05 AC 2 ms
5,396 KB
testcase_06 AC 2 ms
5,484 KB
testcase_07 AC 2 ms
5,392 KB
testcase_08 AC 2 ms
5,452 KB
testcase_09 AC 2 ms
5,460 KB
testcase_10 AC 2 ms
5,512 KB
testcase_11 AC 3 ms
5,496 KB
testcase_12 AC 2 ms
5,452 KB
testcase_13 AC 4 ms
7,996 KB
testcase_14 AC 3 ms
8,120 KB
testcase_15 AC 11 ms
11,140 KB
testcase_16 AC 13 ms
13,284 KB
testcase_17 AC 129 ms
32,064 KB
testcase_18 AC 227 ms
47,284 KB
testcase_19 AC 163 ms
13,740 KB
testcase_20 AC 232 ms
47,276 KB
testcase_21 AC 215 ms
47,280 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:9:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-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