結果

問題 No.11 カードマッチ
ユーザー Makorominiris
提出日時 2016-05-29 22:48:11
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 376 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-11 20:06:07
合計ジャッジ時間 1,483 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

W=int(input())
H=int(input())
N=int(input())
s=0;
m=[]
n=[]
for i in range(0,N):
    S,K=map(int,input().split())
    if (S not in m) and (K not in n):
        H-=1
        W-=1
        s+=H+W
    elif (S in m) and (K not in n):
        H-=1
        s+=W-1
    elif (K in n) and (S not in m):
        W-=1
        s+=H-1
    else: s-=1
    m.append(S)
    n.append(K)
print(s)
0