結果

問題 No.606 カラフルタイル
ユーザー H3PO4H3PO4
提出日時 2020-10-09 14:01:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 235 ms / 2,000 ms
コード長 531 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 10,876 KB
実行使用メモリ 32,020 KB
最終ジャッジ日時 2023-09-27 12:40:02
合計ジャッジ時間 4,847 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,900 KB
testcase_01 AC 14 ms
7,848 KB
testcase_02 AC 15 ms
7,936 KB
testcase_03 AC 16 ms
7,936 KB
testcase_04 AC 15 ms
7,808 KB
testcase_05 AC 14 ms
7,848 KB
testcase_06 AC 14 ms
7,856 KB
testcase_07 AC 14 ms
7,824 KB
testcase_08 AC 15 ms
7,828 KB
testcase_09 AC 14 ms
7,900 KB
testcase_10 AC 16 ms
7,880 KB
testcase_11 AC 14 ms
7,816 KB
testcase_12 AC 15 ms
7,812 KB
testcase_13 AC 27 ms
8,956 KB
testcase_14 AC 14 ms
7,832 KB
testcase_15 AC 15 ms
8,264 KB
testcase_16 AC 135 ms
15,912 KB
testcase_17 AC 215 ms
32,020 KB
testcase_18 AC 163 ms
23,704 KB
testcase_19 AC 161 ms
23,476 KB
testcase_20 AC 235 ms
30,552 KB
testcase_21 AC 174 ms
23,584 KB
testcase_22 AC 174 ms
23,644 KB
testcase_23 AC 188 ms
25,120 KB
testcase_24 AC 202 ms
27,100 KB
testcase_25 AC 191 ms
24,764 KB
testcase_26 AC 211 ms
31,676 KB
testcase_27 AC 218 ms
31,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

input = sys.stdin.readline

N, K, Q = map(int, input().split())
queries = []
for _ in range(Q):
    a, b, c = input().split()
    queries.append((a, int(b) - 1, int(c) - 1))

ans = [0] * K
R, C = set(), set()
for a, b, c in queries[::-1]:
    if a == 'R':
        # 行
        if b in R:
            continue
        R.add(b)
        ans[c] += N - len(C)
    else:
        # 列
        if b in C:
            continue
        C.add(b)
        ans[c] += N - len(R)
ans[0] = N ** 2 - sum(ans[1:])
print(*ans, sep='\n')
0