結果

問題 No.606 カラフルタイル
ユーザー mkawa2mkawa2
提出日時 2020-05-30 16:42:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 717 ms / 2,000 ms
コード長 453 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 39,812 KB
最終ジャッジ日時 2024-04-25 09:15:06
合計ジャッジ時間 8,831 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 32 ms
10,752 KB
testcase_02 AC 32 ms
10,752 KB
testcase_03 AC 33 ms
10,752 KB
testcase_04 AC 29 ms
10,752 KB
testcase_05 AC 28 ms
10,624 KB
testcase_06 AC 28 ms
10,880 KB
testcase_07 AC 29 ms
10,624 KB
testcase_08 AC 29 ms
10,752 KB
testcase_09 AC 30 ms
10,880 KB
testcase_10 AC 29 ms
10,624 KB
testcase_11 AC 30 ms
10,752 KB
testcase_12 AC 30 ms
10,752 KB
testcase_13 AC 42 ms
11,904 KB
testcase_14 AC 31 ms
10,752 KB
testcase_15 AC 31 ms
10,880 KB
testcase_16 AC 163 ms
26,752 KB
testcase_17 AC 511 ms
39,812 KB
testcase_18 AC 443 ms
28,032 KB
testcase_19 AC 378 ms
27,904 KB
testcase_20 AC 717 ms
38,428 KB
testcase_21 AC 615 ms
27,904 KB
testcase_22 AC 603 ms
27,904 KB
testcase_23 AC 588 ms
34,560 KB
testcase_24 AC 650 ms
36,988 KB
testcase_25 AC 237 ms
36,848 KB
testcase_26 AC 705 ms
39,712 KB
testcase_27 AC 499 ms
39,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def MI(): return map(int, sys.stdin.readline().split())
def SI(): return sys.stdin.readline()[:-1]

def main():
    n,k,q=MI()
    abc=[SI().split() for _ in range(q)]
    ans=[0]*k
    cnt=[n]*2
    fin=[0]*2

    for a,b,c in abc[::-1]:
        i=a=="C"
        b,c=int(b)-1,int(c)-1
        if fin[i]>>b&1:continue
        ans[c]+=cnt[1-i]
        fin[i]|=1<<b
        cnt[i]-=1
    ans[0]+=n*n-sum(ans)

    print(*ans,sep="\n")

main()
0