結果

問題 No.459 C-VS for yukicoder
ユーザー maspymaspy
提出日時 2020-03-18 21:21:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,637 bytes
コンパイル時間 651 ms
コンパイル使用メモリ 10,736 KB
実行使用メモリ 11,584 KB
最終ジャッジ日時 2023-08-20 20:15:05
合計ジャッジ時間 10,250 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
8,056 KB
testcase_01 AC 13 ms
7,968 KB
testcase_02 AC 14 ms
8,172 KB
testcase_03 WA -
testcase_04 AC 14 ms
8,076 KB
testcase_05 AC 14 ms
8,080 KB
testcase_06 AC 13 ms
7,972 KB
testcase_07 WA -
testcase_08 AC 13 ms
8,060 KB
testcase_09 AC 14 ms
8,120 KB
testcase_10 AC 13 ms
8,048 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 15 ms
8,080 KB
testcase_14 AC 13 ms
8,132 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 154 ms
11,584 KB
testcase_22 AC 144 ms
10,064 KB
testcase_23 AC 140 ms
10,372 KB
testcase_24 AC 68 ms
10,216 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 39 ms
9,456 KB
testcase_29 AC 60 ms
8,876 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 49 ms
8,844 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

H, W, N = map(int, readline().split())
cols = [0] * W
for _ in range(H):
    S = readline().rstrip()
    for i, x in enumerate(S):
        if x == ord('#'):
            cols[i] += 1
C = list(map(int, read().split()))

use = [0 for _ in range(N)]


def to_string(n):
    n, a = divmod(n, 4)
    c, b = divmod(n, 4)
    ch = '.', '#'
    rows = [None] * 3
    rows[0] = ch[a > 0] + ch[b > 0] + ch[c > 0]
    a -= 1
    b -= 1
    c -= 1
    rows[1] = ch[a > 0] + ch[b > 0] + ch[c > 0]
    a -= 1
    b -= 1
    c -= 1
    rows[2] = ch[a > 0] + ch[b > 0] + ch[c > 0]
    return '\n'.join(rows)


col_to_i = [[] for _ in range(W + 10)]
for i, x in enumerate(C):
    col_to_i[x].append(i)

for col in range(W):
    for i in col_to_i[col - 2]:
        if cols[col] and not use[i]:
            use[i] = 16
            cols[col] -= 1
    for i in col_to_i[col - 1]:
        if cols[col] and not use[i]:
            use[i] = 4
            cols[col] -= 1
    for i in col_to_i[col]:
        if cols[col] and not use[i]:
            use[i] = 1
            cols[col] -= 1

for col in range(W):
    for i in col_to_i[col - 2]:
        n = min(cols[col], 3 - use[i] % 4)
        cols[col] -= n
        use[i] += n * 16
    for i in col_to_i[col - 1]:
        n = min(cols[col], 3 - ((use[i] % 16) // 4))
        cols[col] -= n
        use[i] += 4 * n
    for i in col_to_i[col]:
        n = min(cols[col], 3 - (use[i] // 16))
        cols[col] -= n
        use[i] += n


for n in use:
    print(to_string(n))
0