結果

問題 No.11 カードマッチ
ユーザー 👑 Kazun
提出日時 2020-10-03 03:26:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 36 ms / 5,000 ms
コード長 349 bytes
コンパイル時間 141 ms
コンパイル使用メモリ 82,504 KB
実行使用メモリ 53,616 KB
最終ジャッジ日時 2024-07-18 04:00:59
合計ジャッジ時間 1,427 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

W=int(input())
H=int(input())
N=int(input())

A=set() #マーク
B=set() #数字

X=0
for _ in range(N):
    F=0
    S,K=map(int,input().split())

    if S not in A:
        A.add(S)
        X+=(H-len(B)-(K not in B))
    else:
        F=1
        X-=1

    if K not in B:
        B.add(K)
        X+=(W-len(A))
    elif F==0:
        X-=1

print(X)
0