結果
問題 | No.402 最も海から遠い場所 |
ユーザー |
![]() |
提出日時 | 2016-09-01 08:40:29 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 246 ms / 3,000 ms |
コード長 | 1,861 bytes |
コンパイル時間 | 945 ms |
コンパイル使用メモリ | 117,672 KB |
実行使用メモリ | 83,228 KB |
最終ジャッジ日時 | 2024-11-15 16:31:50 |
合計ジャッジ時間 | 3,642 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
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 || 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(); } }