結果

問題 No.606 カラフルタイル
コンテスト
ユーザー yuppe19 😺
提出日時 2017-12-06 21:13:36
言語 PyPy2
(7.3.20)
コンパイル:
pypy2 -m py_compile _filename_
実行:
/usr/bin/pypy2 Main.pyc
結果
AC  
実行時間 124 ms / 2,000 ms
+ 646µs
コード長 621 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 67 ms
コンパイル使用メモリ 80,640 KB
実行使用メモリ 108,752 KB
最終ジャッジ日時 2026-07-18 17:01:25
合計ジャッジ時間 4,488 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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