結果

問題 No.606 カラフルタイル
ユーザー konsin_tokage
提出日時 2018-06-05 22:59:33
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 558 ms / 2,000 ms
コード長 334 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 45,900 KB
最終ジャッジ日時 2024-06-30 10:08:39
合計ジャッジ時間 7,360 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k, q = map(int, input().split())
s = [input().split() for _ in range(q)]
r = [0]*k
x, y = set(), set()
for a, b, c in s[::-1]:
    b, c = int(b), int(c)
    if a == 'C':
        s, t = x, y
    else:
        s, t = y, x
    if b in t:
        continue
    t.add(b)
    r[c-1] += n-len(s)
r[0] += n*n-sum(r)
for i in r:
    print(i)
0