結果
問題 |
No.402 最も海から遠い場所
|
ユーザー |
![]() |
提出日時 | 2016-09-01 08:35:11 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,905 bytes |
コンパイル時間 | 4,115 ms |
コンパイル使用メモリ | 114,916 KB |
実行使用メモリ | 83,128 KB |
最終ジャッジ日時 | 2024-11-15 16:31:46 |
合計ジャッジ時間 | 6,779 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 19 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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 || i == h - 1 || j == 0 || j == w - 1) { } 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 = @" 8 8 .#..#... .######. #####... #####.#. ######## ######.# #####... ...####. "; 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(); } }