結果

問題 No.606 カラフルタイル
ユーザー GrayCoderGrayCoder
提出日時 2017-12-06 21:30:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 861 bytes
コンパイル時間 1,101 ms
コンパイル使用メモリ 10,788 KB
実行使用メモリ 16,608 KB
最終ジャッジ日時 2023-08-19 09:53:18
合計ジャッジ時間 5,863 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,692 KB
testcase_01 AC 17 ms
8,688 KB
testcase_02 AC 16 ms
8,544 KB
testcase_03 AC 16 ms
8,504 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 15 ms
8,580 KB
testcase_08 WA -
testcase_09 AC 16 ms
8,588 KB
testcase_10 AC 16 ms
8,540 KB
testcase_11 AC 15 ms
8,644 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 15 ms
8,560 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

def main():
    N, K, Q = map(int, input().split())
    ABC = (tuple(input().split()) for _ in [0] * Q)

    tile_r = defaultdict(int)
    tile_c = defaultdict(int)
    for a, b, c in ABC:
        b = int(b)
        c = int(c)
        if a == 'R':
            tile_r[b] = [c, N]
            for i in tile_c.keys():
                tile_c[i][1] -= 1
        elif a == 'C':
            tile_c[b] = [c, N]
            for i in tile_r.keys():
                tile_r[i][1] -= 1

    color = defaultdict(int)
    grey = N ** 2
    for i, j in tile_c.values():
        color[i] += j
        if i > 1:
            grey -= j
    for i, j in tile_r.values():
        color[i] += j
        if i > 1:
            grey -= j

    print(grey)
    for i in range(2, K + 1):
        cnt = color.get(i, 0) + 1
        print(color[i])

main()
0