結果

問題 No.402 最も海から遠い場所
ユーザー 14番14番
提出日時 2016-09-01 08:40:29
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 236 ms / 3,000 ms
コード長 1,861 bytes
コンパイル時間 994 ms
コンパイル使用メモリ 111,588 KB
実行使用メモリ 83,260 KB
最終ジャッジ日時 2024-04-27 14:05:54
合計ジャッジ時間 3,518 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
25,076 KB
testcase_01 AC 28 ms
25,408 KB
testcase_02 AC 27 ms
25,004 KB
testcase_03 AC 27 ms
26,996 KB
testcase_04 AC 25 ms
25,400 KB
testcase_05 AC 26 ms
27,208 KB
testcase_06 AC 26 ms
25,224 KB
testcase_07 AC 25 ms
22,960 KB
testcase_08 AC 24 ms
23,096 KB
testcase_09 AC 26 ms
25,016 KB
testcase_10 AC 28 ms
27,132 KB
testcase_11 AC 28 ms
25,144 KB
testcase_12 AC 27 ms
25,224 KB
testcase_13 AC 27 ms
25,200 KB
testcase_14 AC 26 ms
25,400 KB
testcase_15 AC 32 ms
25,904 KB
testcase_16 AC 35 ms
26,172 KB
testcase_17 AC 138 ms
55,840 KB
testcase_18 AC 236 ms
83,260 KB
testcase_19 AC 123 ms
48,204 KB
testcase_20 AC 234 ms
83,244 KB
testcase_21 AC 211 ms
81,220 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;


class Program
{
    public void Proc()
    {
        Reader.IsDebug = false;
        int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();

        int h = inpt[0];
        int w = inpt[1];

        char[,] map = new char[h, w];
        int[,] step = new int[h, w];
        int maxHen = 0;
        for (int i = 0; i < inpt[0]; i++)
        {
            string row = Reader.ReadLine();
            for (int j = 0; j < inpt[1]; j++)
            {
                map[i, j] = row[j];
                if (row[j] == '#')
                {
                    int val = 1;
                    if (i == 0 || j == 0)
                    {
                    }
                    else
                    {
                        val = Math.Min(step[i - 1, j - 1] + 1, Math.Min(step[i, j - 1] + 1, step[i - 1, j] + 1));
                    }
                    step[i, j] = val;
                    maxHen = Math.Max(maxHen, val);
                }
            }
        }

        Console.WriteLine((maxHen + 1) / 2);
    }




    public class Reader
    {
        public static bool IsDebug = true;
        private static String PlainInput = @"


7 7
#######
#######
#######
#######
#.#####
#..####
#######




";
        private static System.IO.StringReader Sr = null;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (Sr == null)
                {
                    Sr = new System.IO.StringReader(PlainInput.Trim());
                }
                return Sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
    }
    static void Main()
    {
        Program prg = new Program();
        prg.Proc();
    }
}
0