結果

問題 No.402 最も海から遠い場所
ユーザー miraxialmiraxial
提出日時 2016-07-23 00:11:41
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 522 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 90,524 KB
最終ジャッジ日時 2024-04-24 06:48:55
合計ジャッジ時間 8,966 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
12,416 KB
testcase_01 AC 78 ms
12,160 KB
testcase_02 AC 86 ms
12,288 KB
testcase_03 AC 75 ms
12,160 KB
testcase_04 AC 75 ms
12,416 KB
testcase_05 AC 77 ms
12,288 KB
testcase_06 AC 78 ms
12,032 KB
testcase_07 AC 78 ms
12,160 KB
testcase_08 AC 74 ms
12,160 KB
testcase_09 AC 74 ms
12,288 KB
testcase_10 AC 75 ms
12,160 KB
testcase_11 AC 76 ms
12,288 KB
testcase_12 AC 76 ms
12,160 KB
testcase_13 AC 102 ms
12,672 KB
testcase_14 AC 86 ms
12,544 KB
testcase_15 AC 181 ms
14,848 KB
testcase_16 AC 285 ms
15,616 KB
testcase_17 AC 2,103 ms
47,232 KB
testcase_18 TLE -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:26: warning: assigned but unused variable - t
Syntax OK

ソースコード

diff #

h,w=gets.split.map &:to_i
a=[]
h.times do
  g=gets.chomp.split("")
  c=0
  w.times do |i|
    if g[i]==?.
      c=0
      g[i]=0
    else
      c+=1
      g[i]=c
    end
  end
  a<< g
end
w.times do |iw|
  c=0
  h.times do |ih|
    g=a[ih][iw]
    if g==0
      c=0
    else
      c+=1
      cc=c>g ? g:c
      t=true
      1.upto(cc-1) do |i|
        if a[ih-i][iw-i]<=(cc-i)
          cc=a[ih-i][iw-i]+1
          break
        end
      end
      a[ih][iw]=cc if g>cc
    end
  end
end
p (a.map{|i|i.max}.max/2.0).round
0