結果
問題 | No.11 カードマッチ |
ユーザー | あかりき |
提出日時 | 2021-02-08 09:45:32 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 46 ms / 5,000 ms |
コード長 | 445 bytes |
コンパイル時間 | 168 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 62,464 KB |
最終ジャッジ日時 | 2024-07-05 06:04:08 |
合計ジャッジ時間 | 1,915 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
from collections import defaultdictw=int(input())h=int(input())n=int(input())l=[list(map(int,input().split())) for i in range(n)]d=defaultdict(int)for i in range(n):d[l[i][0]*10**8+l[i][1]]=1L1=set()L2=set()for i in range(n):L1.add(l[i][0])L2.add(l[i][1])L1=list(L1)L2=list(L2)ans=len(L1)*h+len(L2)*w-len(L1)*len(L2)for i in range(len(L1)):for j in range(len(L2)):if d[L1[i]*10**8+L2[j]]==1:ans-=1print(ans)