結果

問題 No.606 カラフルタイル
ユーザー maspymaspy
提出日時 2020-03-03 14:50:08
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 205 ms / 2,000 ms
コード長 751 bytes
コンパイル時間 1,299 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 27,924 KB
最終ジャッジ日時 2024-04-22 00:04:03
合計ジャッジ時間 5,177 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,624 KB
testcase_01 AC 26 ms
10,752 KB
testcase_02 AC 28 ms
12,032 KB
testcase_03 AC 27 ms
10,624 KB
testcase_04 AC 26 ms
10,752 KB
testcase_05 AC 26 ms
10,752 KB
testcase_06 AC 31 ms
10,624 KB
testcase_07 AC 25 ms
10,624 KB
testcase_08 AC 26 ms
10,624 KB
testcase_09 AC 26 ms
10,752 KB
testcase_10 AC 27 ms
10,624 KB
testcase_11 AC 26 ms
10,752 KB
testcase_12 AC 25 ms
10,752 KB
testcase_13 AC 38 ms
11,264 KB
testcase_14 AC 28 ms
12,288 KB
testcase_15 AC 28 ms
10,624 KB
testcase_16 AC 131 ms
16,896 KB
testcase_17 AC 196 ms
26,868 KB
testcase_18 AC 168 ms
17,920 KB
testcase_19 AC 156 ms
17,664 KB
testcase_20 AC 205 ms
26,376 KB
testcase_21 AC 161 ms
18,560 KB
testcase_22 AC 160 ms
18,432 KB
testcase_23 AC 170 ms
18,944 KB
testcase_24 AC 200 ms
23,904 KB
testcase_25 AC 171 ms
24,660 KB
testcase_26 AC 200 ms
27,920 KB
testcase_27 AC 204 ms
27,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/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:])))
0