結果

問題 No.157 2つの空洞
ユーザー 👑 hos.lyrichos.lyric
提出日時 2015-02-27 02:21:35
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 318 bytes
コンパイル時間 58 ms
コンパイル使用メモリ 11,568 KB
実行使用メモリ 20,292 KB
最終ジャッジ日時 2023-09-06 03:33:18
合計ジャッジ時間 5,873 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
15,128 KB
testcase_01 AC 83 ms
15,268 KB
testcase_02 AC 82 ms
15,276 KB
testcase_03 AC 83 ms
15,292 KB
testcase_04 AC 83 ms
15,276 KB
testcase_05 AC 89 ms
15,220 KB
testcase_06 AC 88 ms
15,216 KB
testcase_07 AC 78 ms
15,092 KB
testcase_08 AC 79 ms
15,288 KB
testcase_09 AC 83 ms
15,360 KB
testcase_10 AC 83 ms
15,048 KB
testcase_11 AC 92 ms
15,492 KB
testcase_12 AC 107 ms
15,248 KB
testcase_13 AC 120 ms
15,280 KB
testcase_14 AC 151 ms
20,292 KB
testcase_15 AC 154 ms
17,704 KB
testcase_16 AC 164 ms
15,364 KB
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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]
(a[x=q.shift][y=q.shift]=?!;[[x+1,y],[x,y+1],[x-1,y],[x,y-1]].map{|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