結果

問題 No.606 カラフルタイル
ユーザー qibqib
提出日時 2023-01-26 15:52:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 257 ms / 2,000 ms
コード長 532 bytes
コンパイル時間 1,410 ms
コンパイル使用メモリ 86,820 KB
実行使用メモリ 129,372 KB
最終ジャッジ日時 2023-09-09 16:49:48
合計ジャッジ時間 6,576 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,396 KB
testcase_01 AC 70 ms
71,284 KB
testcase_02 AC 71 ms
71,300 KB
testcase_03 AC 69 ms
71,492 KB
testcase_04 AC 71 ms
71,176 KB
testcase_05 AC 70 ms
71,388 KB
testcase_06 AC 71 ms
71,180 KB
testcase_07 AC 71 ms
71,368 KB
testcase_08 AC 70 ms
71,388 KB
testcase_09 AC 70 ms
71,200 KB
testcase_10 AC 71 ms
71,276 KB
testcase_11 AC 70 ms
71,292 KB
testcase_12 AC 70 ms
71,124 KB
testcase_13 AC 104 ms
79,344 KB
testcase_14 AC 71 ms
71,412 KB
testcase_15 AC 84 ms
75,148 KB
testcase_16 AC 177 ms
97,288 KB
testcase_17 AC 236 ms
129,372 KB
testcase_18 AC 190 ms
111,600 KB
testcase_19 AC 191 ms
107,308 KB
testcase_20 AC 257 ms
117,076 KB
testcase_21 AC 199 ms
107,004 KB
testcase_22 AC 199 ms
107,184 KB
testcase_23 AC 217 ms
107,712 KB
testcase_24 AC 236 ms
113,180 KB
testcase_25 AC 191 ms
97,516 KB
testcase_26 AC 230 ms
127,140 KB
testcase_27 AC 236 ms
129,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k, q = map(int, input().split())
queries = [input().split() for _ in range(q)]

row = {}
col = {}
cnt = {}
for i in range(q - 1, -1, -1):
  a, b, c = queries[i]
  b = int(b) - 1
  c = int(c) - 1
  if a == 'R':
    if row.get(b, None) is None:
      cnt[c] = cnt.get(c, 0) + n - len(col)
      row[b] = c
  else:
    if col.get(b, None) is None:
      cnt[c] = cnt.get(c, 0) + n - len(row)
      col[b] = c

rest = n * n
for c, v in cnt.items():
  if c != 0:
    rest -= v

cnt[0] = rest

for c in range(k):
  print(cnt.get(c, 0))
0