結果

問題 No.606 カラフルタイル
ユーザー brthyyjp
提出日時 2021-03-08 00:40:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 207 ms / 2,000 ms
コード長 470 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 82,188 KB
実行使用メモリ 112,156 KB
最終ジャッジ日時 2024-10-09 10:53:09
合計ジャッジ時間 5,374 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k, q = map(int, input().split())
Q = []
for i in range(q):
    a, b, c = map(str, input().split())
    b, c = int(b), int(c)
    b, c = b-1, c-1
    Q.append((a, b, c))

Q.reverse()
usedR = set()
usedC = set()
C = [0]*k
for a, b, c in Q:
    if a == 'R':
        if b not in usedR:
            C[c] += n-len(usedC)
        usedR.add(b)
    else:
        if b not in usedC:
            C[c] += n-len(usedR)
        usedC.add(b)
C[0] += n**2-sum(C)
print(*C, sep='\n')
0