結果

問題 No.157 2つの空洞
ユーザー 👑 hos.lyrichos.lyric
提出日時 2015-02-27 02:14:36
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,329 ms / 2,000 ms
コード長 330 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 11,256 KB
実行使用メモリ 15,500 KB
最終ジャッジ日時 2023-09-06 03:30:48
合計ジャッジ時間 12,146 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
15,256 KB
testcase_01 AC 135 ms
15,352 KB
testcase_02 AC 167 ms
15,272 KB
testcase_03 AC 194 ms
15,500 KB
testcase_04 AC 234 ms
15,236 KB
testcase_05 AC 278 ms
15,256 KB
testcase_06 AC 364 ms
15,456 KB
testcase_07 AC 182 ms
15,436 KB
testcase_08 AC 168 ms
15,468 KB
testcase_09 AC 276 ms
15,300 KB
testcase_10 AC 191 ms
15,292 KB
testcase_11 AC 426 ms
15,096 KB
testcase_12 AC 580 ms
15,064 KB
testcase_13 AC 708 ms
15,188 KB
testcase_14 AC 952 ms
15,376 KB
testcase_15 AC 982 ms
15,348 KB
testcase_16 AC 1,028 ms
15,168 KB
testcase_17 AC 1,329 ms
15,304 KB
testcase_18 AC 976 ms
15,404 KB
testcase_19 AC 970 ms
15,264 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n,m=gets.split.map &:to_i
a=(1..m).map{gets}
c=999
(0...m).any?{|x|(0...n).any?{|y|a[x][y]>?-&&(a[x][y]=?!
c.times{m.times{|x|n.times{|y|[[x+1,y],[x,y+1],[x-1,y],[x,y-1]].map{|z,w|a[x][y]<?"&&a[z][w]>?-&&(a[z][w]=?!)}}}})}}
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