結果

問題 No.459 C-VS for yukicoder
ユーザー miraxialmiraxial
提出日時 2016-12-10 01:16:31
言語 Ruby
(3.3.0)
結果
AC  
実行時間 477 ms / 2,000 ms
コード長 695 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 11,112 KB
実行使用メモリ 20,516 KB
最終ジャッジ日時 2023-08-27 06:44:22
合計ジャッジ時間 12,803 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,080 KB
testcase_01 AC 83 ms
15,140 KB
testcase_02 AC 84 ms
15,084 KB
testcase_03 AC 82 ms
15,252 KB
testcase_04 AC 84 ms
15,088 KB
testcase_05 AC 83 ms
15,276 KB
testcase_06 AC 84 ms
15,304 KB
testcase_07 AC 84 ms
15,080 KB
testcase_08 AC 84 ms
15,116 KB
testcase_09 AC 83 ms
14,984 KB
testcase_10 AC 84 ms
15,244 KB
testcase_11 AC 83 ms
15,092 KB
testcase_12 AC 83 ms
15,092 KB
testcase_13 AC 83 ms
15,012 KB
testcase_14 AC 84 ms
15,216 KB
testcase_15 AC 90 ms
15,212 KB
testcase_16 AC 89 ms
15,280 KB
testcase_17 AC 86 ms
15,296 KB
testcase_18 AC 85 ms
15,144 KB
testcase_19 AC 84 ms
15,148 KB
testcase_20 AC 85 ms
15,084 KB
testcase_21 AC 477 ms
20,516 KB
testcase_22 AC 412 ms
20,208 KB
testcase_23 AC 476 ms
20,460 KB
testcase_24 AC 207 ms
16,792 KB
testcase_25 AC 133 ms
15,636 KB
testcase_26 AC 134 ms
15,692 KB
testcase_27 AC 132 ms
15,528 KB
testcase_28 AC 128 ms
15,692 KB
testcase_29 AC 199 ms
16,364 KB
testcase_30 AC 131 ms
15,532 KB
testcase_31 AC 147 ms
15,828 KB
testcase_32 AC 90 ms
15,264 KB
testcase_33 AC 156 ms
15,980 KB
testcase_34 AC 173 ms
16,360 KB
testcase_35 AC 92 ms
15,404 KB
testcase_36 AC 178 ms
16,252 KB
testcase_37 AC 93 ms
15,376 KB
testcase_38 AC 157 ms
16,116 KB
testcase_39 AC 97 ms
15,212 KB
testcase_40 AC 144 ms
15,648 KB
testcase_41 AC 91 ms
15,260 KB
testcase_42 AC 143 ms
15,504 KB
testcase_43 AC 168 ms
16,036 KB
testcase_44 AC 103 ms
15,244 KB
testcase_45 AC 98 ms
15,444 KB
testcase_46 AC 99 ms
15,248 KB
testcase_47 AC 94 ms
15,120 KB
testcase_48 AC 168 ms
16,212 KB
testcase_49 AC 94 ms
15,312 KB
testcase_50 AC 153 ms
15,944 KB
testcase_51 AC 93 ms
15,192 KB
testcase_52 AC 121 ms
15,268 KB
testcase_53 AC 99 ms
15,204 KB
testcase_54 AC 162 ms
15,924 KB
testcase_55 AC 112 ms
15,564 KB
testcase_56 AC 145 ms
15,624 KB
testcase_57 AC 91 ms
15,268 KB
testcase_58 AC 173 ms
16,328 KB
testcase_59 AC 101 ms
15,408 KB
testcase_60 AC 119 ms
15,572 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

h,w,n=gets.split.map &:to_i
c=[0]*w
h.times do |i|
  g=gets.chomp
  w.times do |i|
    c[i]+=1 if g[i]==?#
  end
end
d=[0]*w
v=[]
n.times do |i|
  v<< [gets.to_i,i]
end
v.each do |e|
  3.times do |i|
    d[e[0]+i]+=1
  end
end
w=v.sort
f=[]
w.each do |e|
  g=[]
  3.times do |i|
    t=e[0]+i
    d[t]-=1
    if c[t]>=d[t]*3
      g<< c[t]-d[t]*3
      c[t]=d[t]*3
    else
      g<< 0
    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