結果

問題 No.459 C-VS for yukicoder
ユーザー maimai
提出日時 2016-11-20 14:54:23
言語 Ruby
(3.3.0)
結果
AC  
実行時間 300 ms / 2,000 ms
コード長 986 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 11,232 KB
実行使用メモリ 18,176 KB
最終ジャッジ日時 2023-08-27 02:40:16
合計ジャッジ時間 12,620 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
15,300 KB
testcase_01 AC 84 ms
15,252 KB
testcase_02 AC 84 ms
15,104 KB
testcase_03 AC 85 ms
15,248 KB
testcase_04 AC 85 ms
15,304 KB
testcase_05 AC 84 ms
15,068 KB
testcase_06 AC 85 ms
14,996 KB
testcase_07 AC 84 ms
15,160 KB
testcase_08 AC 83 ms
15,132 KB
testcase_09 AC 85 ms
15,184 KB
testcase_10 AC 83 ms
15,088 KB
testcase_11 AC 85 ms
15,260 KB
testcase_12 AC 83 ms
15,064 KB
testcase_13 AC 82 ms
15,344 KB
testcase_14 AC 83 ms
14,992 KB
testcase_15 AC 89 ms
15,376 KB
testcase_16 AC 88 ms
15,428 KB
testcase_17 AC 88 ms
15,344 KB
testcase_18 AC 86 ms
15,248 KB
testcase_19 AC 86 ms
15,200 KB
testcase_20 AC 86 ms
15,056 KB
testcase_21 AC 300 ms
18,176 KB
testcase_22 AC 294 ms
17,740 KB
testcase_23 AC 293 ms
18,028 KB
testcase_24 AC 161 ms
16,680 KB
testcase_25 AC 124 ms
16,188 KB
testcase_26 AC 123 ms
15,628 KB
testcase_27 AC 116 ms
15,376 KB
testcase_28 AC 118 ms
16,140 KB
testcase_29 AC 169 ms
16,108 KB
testcase_30 AC 123 ms
15,464 KB
testcase_31 AC 130 ms
15,820 KB
testcase_32 AC 94 ms
15,164 KB
testcase_33 AC 133 ms
16,020 KB
testcase_34 AC 143 ms
16,368 KB
testcase_35 AC 96 ms
15,288 KB
testcase_36 AC 144 ms
15,852 KB
testcase_37 AC 95 ms
15,140 KB
testcase_38 AC 134 ms
16,404 KB
testcase_39 AC 95 ms
15,232 KB
testcase_40 AC 126 ms
15,724 KB
testcase_41 AC 90 ms
15,236 KB
testcase_42 AC 120 ms
15,572 KB
testcase_43 AC 139 ms
16,144 KB
testcase_44 AC 100 ms
15,492 KB
testcase_45 AC 96 ms
15,436 KB
testcase_46 AC 97 ms
15,340 KB
testcase_47 AC 94 ms
15,220 KB
testcase_48 AC 140 ms
15,840 KB
testcase_49 AC 95 ms
15,428 KB
testcase_50 AC 132 ms
15,916 KB
testcase_51 AC 93 ms
15,436 KB
testcase_52 AC 110 ms
15,532 KB
testcase_53 AC 98 ms
15,388 KB
testcase_54 AC 138 ms
15,916 KB
testcase_55 AC 105 ms
15,388 KB
testcase_56 AC 127 ms
15,524 KB
testcase_57 AC 94 ms
15,464 KB
testcase_58 AC 147 ms
16,048 KB
testcase_59 AC 100 ms
15,612 KB
testcase_60 AC 110 ms
15,676 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def max(a,b);a>=b ? a : b;end
def min(a,b);a<=b ? a : b;end


@height,@width,@n = gets.split.map(&:to_i)


field = Array.new(@width,0)

@height.times{
    x = 0
    gets.chomp!.chars{|c|
        field[x]+=1 if c=='#'
        x+=1
    }
}


command = Array.new(@n,0)
pack = Array.new(@n){Array.new(3,0)}
command_bucket = Array.new(@width){[]}

@n.times{|i|
    x = gets.to_i
    command[i] = x
    command_bucket[x] << i
}

cursor = 0
@width.times{|x|
    cursor = max(x,cursor)
    command_bucket[x].each{|idx|
        while (field[cursor] == 0) ; cursor += 1 ; end
        pack[idx][cursor-x] += 1
        field[cursor] -= 1
    }
}

@width.times{|x|
    command_bucket[x].each{|idx|
        3.times{|ofs|
            fil = max(0,min(3-pack[idx][ofs],field[x+ofs]))
            pack[idx][ofs] += fil
            field[x+ofs]   -= fil
        }
    }
}

pack.each{|v|
    3.downto(1){|y|
        0.upto(2){|x|
            print (y <= v[x]) ? '#' : '.'
        }
        puts ""
    }
}
0