結果

問題 No.459 C-VS for yukicoder
ユーザー miraxialmiraxial
提出日時 2016-12-10 00:56:01
言語 Ruby
(3.3.0)
結果
AC  
実行時間 463 ms / 2,000 ms
コード長 765 bytes
コンパイル時間 643 ms
コンパイル使用メモリ 11,332 KB
実行使用メモリ 20,936 KB
最終ジャッジ日時 2023-08-19 06:38:46
合計ジャッジ時間 12,120 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,048 KB
testcase_01 AC 81 ms
15,300 KB
testcase_02 AC 80 ms
15,128 KB
testcase_03 AC 80 ms
15,160 KB
testcase_04 AC 81 ms
15,168 KB
testcase_05 AC 81 ms
15,024 KB
testcase_06 AC 82 ms
15,244 KB
testcase_07 AC 82 ms
15,224 KB
testcase_08 AC 81 ms
15,028 KB
testcase_09 AC 81 ms
15,276 KB
testcase_10 AC 81 ms
15,172 KB
testcase_11 AC 81 ms
15,128 KB
testcase_12 AC 82 ms
15,336 KB
testcase_13 AC 82 ms
15,184 KB
testcase_14 AC 82 ms
15,164 KB
testcase_15 AC 89 ms
15,228 KB
testcase_16 AC 89 ms
15,368 KB
testcase_17 AC 85 ms
15,088 KB
testcase_18 AC 88 ms
15,268 KB
testcase_19 AC 87 ms
15,224 KB
testcase_20 AC 83 ms
15,160 KB
testcase_21 AC 463 ms
20,796 KB
testcase_22 AC 398 ms
20,936 KB
testcase_23 AC 455 ms
20,312 KB
testcase_24 AC 195 ms
16,872 KB
testcase_25 AC 128 ms
15,788 KB
testcase_26 AC 130 ms
16,044 KB
testcase_27 AC 128 ms
15,664 KB
testcase_28 AC 123 ms
15,744 KB
testcase_29 AC 196 ms
17,056 KB
testcase_30 AC 132 ms
16,184 KB
testcase_31 AC 143 ms
15,996 KB
testcase_32 AC 90 ms
15,340 KB
testcase_33 AC 150 ms
16,216 KB
testcase_34 AC 168 ms
16,128 KB
testcase_35 AC 91 ms
15,288 KB
testcase_36 AC 172 ms
16,328 KB
testcase_37 AC 93 ms
15,256 KB
testcase_38 AC 153 ms
16,164 KB
testcase_39 AC 93 ms
15,124 KB
testcase_40 AC 140 ms
15,780 KB
testcase_41 AC 87 ms
15,324 KB
testcase_42 AC 138 ms
15,792 KB
testcase_43 AC 163 ms
16,328 KB
testcase_44 AC 100 ms
15,212 KB
testcase_45 AC 97 ms
15,272 KB
testcase_46 AC 97 ms
15,156 KB
testcase_47 AC 91 ms
15,164 KB
testcase_48 AC 162 ms
16,284 KB
testcase_49 AC 90 ms
15,324 KB
testcase_50 AC 148 ms
16,008 KB
testcase_51 AC 89 ms
15,360 KB
testcase_52 AC 116 ms
15,524 KB
testcase_53 AC 96 ms
15,324 KB
testcase_54 AC 156 ms
16,032 KB
testcase_55 AC 110 ms
15,396 KB
testcase_56 AC 140 ms
15,700 KB
testcase_57 AC 90 ms
15,304 KB
testcase_58 AC 168 ms
16,440 KB
testcase_59 AC 102 ms
15,400 KB
testcase_60 AC 117 ms
15,356 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

h,w,n=gets.split.map &:to_i
a=[]
c=[0]*w
h.times do |i|
  a<< g=gets.chomp
  w.times do |i|
    c[i]+=1 if g[i]==?#
  end
end
d=[0]*w
v=*$<.map(&:to_i)
v.each do |e|
  d[e]+=1
  d[e+1]+=1
  d[e+2]+=1
end
n.times do |i|
  v[i]=[v[i],i]
end
w=v.sort
f=[]
w.each do |e|
  g=[]
  3.times do |i|
    t=e[0]+i
    d[t]-=1
    if d[t]==0
      g<< c[t]
    else
      if d[t]*3<c[t]
        g<< c[t]-d[t]*3
        c[t]=d[t]*3
      else
        g<< 0
      end
    end
  end
  if g==[0,0,0]
    3.times do |i|
      t=e[0]+i
      if c[t]!=0
        g[i]+=1
        c[t]-=1
        break
      end
    end
  end
  f<< g+[e[1]]
end
f.sort!{|a,b|a[3]<=>b[3]}
f.each do |e|
  3.times do |i|
    s=""
    3.times do |j|
      s+=e[j]>=3-i ? ?#:?.
    end
    puts s
  end
end
0