結果
問題 | No.402 最も海から遠い場所 |
ユーザー | 明智重蔵 |
提出日時 | 2016-09-10 13:32:25 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 9,139 bytes |
コンパイル時間 | 1,001 ms |
コンパイル使用メモリ | 108,672 KB |
実行使用メモリ | 68,352 KB |
最終ジャッジ日時 | 2024-04-28 06:41:51 |
合計ジャッジ時間 | 7,541 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 28 ms
19,712 KB |
testcase_01 | AC | 26 ms
19,712 KB |
testcase_02 | AC | 27 ms
19,968 KB |
testcase_03 | AC | 26 ms
19,712 KB |
testcase_04 | WA | - |
testcase_05 | AC | 28 ms
19,968 KB |
testcase_06 | AC | 27 ms
19,840 KB |
testcase_07 | AC | 26 ms
19,712 KB |
testcase_08 | AC | 28 ms
19,712 KB |
testcase_09 | AC | 28 ms
19,840 KB |
testcase_10 | AC | 27 ms
19,712 KB |
testcase_11 | AC | 27 ms
19,712 KB |
testcase_12 | WA | - |
testcase_13 | AC | 31 ms
19,968 KB |
testcase_14 | WA | - |
testcase_15 | AC | 41 ms
20,636 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | TLE | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
コンパイルメッセージ
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.Linq; //YukiCoder402 最も海から遠い場所 //http://yukicoder.me/problems/no/402 class Program { static string InputPattern = "InputX"; static List<string> GetInputList() { var WillReturn = new List<string>(); if (InputPattern == "Input1") { WillReturn.Add("8 8"); WillReturn.Add(".#..#..."); WillReturn.Add(".######."); WillReturn.Add("#####..."); WillReturn.Add("#####.#."); WillReturn.Add("########"); WillReturn.Add("######.#"); WillReturn.Add("#####..."); WillReturn.Add("...####."); //3 } else if (InputPattern == "Input2") { WillReturn.Add("7 7"); WillReturn.Add("#######"); WillReturn.Add("#######"); WillReturn.Add("#######"); WillReturn.Add("#######"); WillReturn.Add("#.#####"); WillReturn.Add("#..####"); WillReturn.Add("#######"); //3 } else if (InputPattern == "Input3") { WillReturn.Add("60 60"); WillReturn.Add("............................................................"); WillReturn.Add("............................................................"); WillReturn.Add("........................................#...............##.."); WillReturn.Add(".......................................####............##..."); WillReturn.Add(".........................................##...........##...."); WillReturn.Add(".........................................###........#......."); WillReturn.Add(".........................................#####...#..#......."); WillReturn.Add(".........................................#########....#....."); WillReturn.Add("........................................###########........."); WillReturn.Add("........................................#############......."); WillReturn.Add(".....................................##.##########.........."); WillReturn.Add("......................................#########............."); WillReturn.Add(".....................................#########.............."); WillReturn.Add("....................................##.#...###.............."); WillReturn.Add("...................................###.......#.............."); WillReturn.Add(".....................................###...................."); WillReturn.Add(".....................................#......................"); WillReturn.Add(".......................................##..................."); WillReturn.Add("......................................#.#..................."); WillReturn.Add(".....................................####..................."); WillReturn.Add(".....................................####..................."); WillReturn.Add(".....................................#####.................."); WillReturn.Add(".....................................######................."); WillReturn.Add(".....................................######................."); WillReturn.Add(".....................................######................."); WillReturn.Add(".....................................#####.................."); WillReturn.Add("....................................#####..................."); WillReturn.Add("....................................#####..................."); WillReturn.Add("....................................######.................."); WillReturn.Add("...................................#####...................."); WillReturn.Add("................................#.######...................."); WillReturn.Add(".................................#######...................."); WillReturn.Add("............................#...########...................."); WillReturn.Add("............................#.##########...................."); WillReturn.Add("...........................############....................."); WillReturn.Add("...........................############....................."); WillReturn.Add("..........................#############....................."); WillReturn.Add(".........................###############...................."); WillReturn.Add("....................###..##############....................."); WillReturn.Add("...............#####################.##....................."); WillReturn.Add("..............###################.#..#......................"); WillReturn.Add(".....#......###############.####..#........................."); WillReturn.Add("..........########......###................................."); WillReturn.Add("..........####....##.#.#####................................"); WillReturn.Add("......#.##...#.######..###.................................."); WillReturn.Add(".....##.####...######..##..................................."); WillReturn.Add("......######..####.#........................................"); WillReturn.Add("...#...######.###..........................................."); WillReturn.Add("......##.####..#............................................"); WillReturn.Add(".......#.###................................................"); WillReturn.Add("........####................................................"); WillReturn.Add(".......####................................................."); WillReturn.Add(".......####................................................."); WillReturn.Add(".......#.##................................................."); WillReturn.Add("............................................................"); WillReturn.Add("..........#................................................."); WillReturn.Add("........#.#................................................."); WillReturn.Add("............................................................"); WillReturn.Add("............................................................"); WillReturn.Add("............................................................"); //4 } else { string wkStr; while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr); } return WillReturn; } static int UB_X; static int UB_Y; static void Main() { List<string> InputList = GetInputList(); int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray(); int H = wkArr[0]; int W = wkArr[1]; UB_X = W - 1; UB_Y = H - 1; char[,] BanArr = new char[UB_X + 1, UB_Y + 1]; for (int LoopX = 0; LoopX <= UB_X; LoopX++) { for (int LoopY = 0; LoopY <= UB_Y; LoopY++) { BanArr[LoopX, LoopY] = InputList[LoopY + 1][LoopX]; } } //最大の正方形の1辺を求める int MaxSeihoukeiLength = 1; for (int LoopX = 0; LoopX <= UB_X; LoopX++) { if (LoopX + MaxSeihoukeiLength - 1 > UB_X) break; for (int LoopY = 0; LoopY <= UB_Y; LoopY++) { if (LoopY + MaxSeihoukeiLength - 1 > UB_Y) break; if (BanArr[LoopX, LoopY] == '.') continue; int wkSeihoukeiLength = DeriveSeihoukeiLength(BanArr, LoopX, LoopY); if (MaxSeihoukeiLength < wkSeihoukeiLength) MaxSeihoukeiLength = wkSeihoukeiLength; } } if (MaxSeihoukeiLength % 2 == 0) Console.WriteLine(MaxSeihoukeiLength / 2); else Console.WriteLine(MaxSeihoukeiLength / 2 + 1); } //始点を引数として、正方形の大きさを返す static int DeriveSeihoukeiLength(char[,] pBanArr, int pStaX, int pStaY) { int SeihoukeiLength = 1; while (true) { //UB超えの場合 if (pStaX + SeihoukeiLength - 1 > UB_X) return SeihoukeiLength - 1; if (pStaY + SeihoukeiLength - 1 > UB_Y) return SeihoukeiLength - 1; //横のループ for (int X = pStaX; X <= pStaX + SeihoukeiLength - 1; X++) { if (pBanArr[X, pStaY + SeihoukeiLength - 1] == '.') return SeihoukeiLength - 1; } //縦のループ for (int Y = pStaY; Y <= pStaY + SeihoukeiLength - 1; Y++) { if (pBanArr[pStaX + SeihoukeiLength - 1, pStaY] == '.') return SeihoukeiLength - 1; } SeihoukeiLength++; } } }