結果

問題 No.606 カラフルタイル
コンテスト
ユーザー yuppe19 😺
提出日時 2017-12-06 21:13:36
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 177 ms / 2,000 ms
コード長 621 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 262 ms
コンパイル使用メモリ 77,572 KB
最終ジャッジ日時 2025-12-04 00:49:55
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#!/usr/bin/python2
# -*- coding: utf-8 -*-
# †
n, C, Q = map(int, raw_input().split())

seenR = [False] * n
seenC = [False] * n
r_inc, c_inc = n, n
cnt = [0] * C

Qs = []
for _ in xrange(Q):
    a, b, c = raw_input().split()
    b = int(b) - 1
    c = int(c) - 1
    Qs.append([a, b, c])

Qs.reverse()

for a, b, c in Qs:
    if a == 'R':
        if not seenR[b]:
            seenR[b] = True
            cnt[c] += r_inc
            c_inc -= 1
    else:
        if not seenC[b]:
            seenC[b] = True
            cnt[c] += c_inc
            r_inc -= 1
cnt[0] = n * n - sum(cnt[1:])

print '\n'.join(map(str, cnt))
0