結果

問題 No.11 カードマッチ
ユーザー こるこる
提出日時 2017-01-07 11:20:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 103 ms / 5,000 ms
コード長 327 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 23,864 KB
最終ジャッジ日時 2023-08-22 15:41:43
合計ジャッジ時間 2,028 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,892 KB
testcase_01 AC 16 ms
7,844 KB
testcase_02 AC 15 ms
8,004 KB
testcase_03 AC 16 ms
7,844 KB
testcase_04 AC 53 ms
15,008 KB
testcase_05 AC 16 ms
7,892 KB
testcase_06 AC 101 ms
23,860 KB
testcase_07 AC 46 ms
13,316 KB
testcase_08 AC 62 ms
16,324 KB
testcase_09 AC 103 ms
23,864 KB
testcase_10 AC 85 ms
20,940 KB
testcase_11 AC 78 ms
19,540 KB
testcase_12 AC 81 ms
20,104 KB
testcase_13 AC 75 ms
19,272 KB
testcase_14 AC 49 ms
14,176 KB
testcase_15 AC 17 ms
7,860 KB
testcase_16 AC 19 ms
8,936 KB
testcase_17 AC 19 ms
8,884 KB
testcase_18 AC 20 ms
8,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

w=int(input())
h=int(input())
n=int(input())

w_array=[0 for i in range(w+1)]
h_array=[0 for i in range(h+1)]
w_w=0
h_h=0
for j in range(n):
    a,b=[int(i) for i in input().split()]
    if w_array[a]==0:
        w_w+=1
        w_array[a]=1
    if h_array[b]==0:
        h_h+=1
        h_array[b]=1
print(h*w_w+w*h_h-w_w*h_h-n)
0