結果

問題 No.11 カードマッチ
ユーザー あかりきあかりき
提出日時 2021-02-08 09:45:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 110 ms / 5,000 ms
コード長 445 bytes
コンパイル時間 367 ms
コンパイル使用メモリ 87,000 KB
実行使用メモリ 77,964 KB
最終ジャッジ日時 2023-09-18 15:27:38
合計ジャッジ時間 3,358 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
71,432 KB
testcase_01 AC 98 ms
71,532 KB
testcase_02 AC 97 ms
71,692 KB
testcase_03 AC 99 ms
71,476 KB
testcase_04 AC 107 ms
77,344 KB
testcase_05 AC 99 ms
71,340 KB
testcase_06 AC 102 ms
71,572 KB
testcase_07 AC 107 ms
77,728 KB
testcase_08 AC 107 ms
77,740 KB
testcase_09 AC 110 ms
77,636 KB
testcase_10 AC 107 ms
77,364 KB
testcase_11 AC 107 ms
77,536 KB
testcase_12 AC 108 ms
77,168 KB
testcase_13 AC 107 ms
77,028 KB
testcase_14 AC 108 ms
77,304 KB
testcase_15 AC 109 ms
77,536 KB
testcase_16 AC 110 ms
77,964 KB
testcase_17 AC 110 ms
77,600 KB
testcase_18 AC 109 ms
77,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
w=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]]=1
L1=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-=1
print(ans)
0