結果
| 問題 | No.606 カラフルタイル | 
| コンテスト | |
| ユーザー |  maspy | 
| 提出日時 | 2020-03-03 14:50:08 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 216 ms / 2,000 ms | 
| コード長 | 751 bytes | 
| コンパイル時間 | 112 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 27,792 KB | 
| 最終ジャッジ日時 | 2024-10-13 22:35:02 | 
| 合計ジャッジ時間 | 4,575 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 25 | 
ソースコード
#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# %%
N, K, Q = map(int, readline().split())
query = readlines()
# %%
color_cnt = [0] * (K + 1)
rest_row = [True] * (N + 1)
rest_col = [True] * (N + 1)
rest_row_cnt = N
rest_col_cnt = N
# %%
for q in query[::-1]:
    a, b, c = q.split()
    b = int(b)
    c = int(c)
    if a == b'R' and rest_row[b]:
        color_cnt[c] += rest_col_cnt
        rest_row[b] = False
        rest_row_cnt -= 1
    if a == b'C' and rest_col[b]:
        color_cnt[c] += rest_row_cnt
        rest_col[b] = False
        rest_col_cnt -= 1
# %%
color_cnt[1] += N * N - sum(color_cnt)
print('\n'.join(map(str, color_cnt[1:])))
            
            
            
        