結果

問題 No.157 2つの空洞
ユーザー 👑 hos.lyrichos.lyric
提出日時 2015-02-27 02:19:46
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 324 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 11,332 KB
実行使用メモリ 15,464 KB
最終ジャッジ日時 2023-09-06 03:31:01
合計ジャッジ時間 3,176 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 78 ms
15,076 KB
testcase_03 AC 78 ms
15,044 KB
testcase_04 AC 78 ms
15,088 KB
testcase_05 AC 82 ms
15,232 KB
testcase_06 AC 88 ms
15,440 KB
testcase_07 AC 80 ms
15,260 KB
testcase_08 AC 80 ms
15,320 KB
testcase_09 AC 83 ms
15,264 KB
testcase_10 AC 80 ms
15,140 KB
testcase_11 AC 92 ms
15,256 KB
testcase_12 AC 107 ms
15,276 KB
testcase_13 AC 124 ms
15,300 KB
testcase_14 AC 134 ms
15,352 KB
testcase_15 AC 150 ms
15,204 KB
testcase_16 AC 165 ms
15,464 KB
testcase_17 AC 167 ms
15,448 KB
testcase_18 AC 160 ms
15,308 KB
testcase_19 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n,m=gets.split.map &:to_i
a=(1..m).map{gets}
(0...m).any?{|x|(0...n).any?{|y|a[x][y]>?-&&(q=[x,y]
(x=q.shift;y=q.shift;[[x+1,y],[x,y+1],[x-1,y],[x,y-1]].map{|z,w|a[z][w]>?-&&(a[z][w]=?!;q+=[z,w])})while[]!=q;0)}}
c=99
m.times{|x|n.times{|y|m.times{|z|n.times{|w|a[x][y]+a[z][w]==".!"&&c=[c,(x-z).abs+(y-w).abs-1].min}}}}
p c
0