結果

問題 No.11 カードマッチ
ユーザー taisuketaisuke
提出日時 2023-02-22 14:33:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 123 ms / 5,000 ms
コード長 351 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 10,904 KB
実行使用メモリ 23,992 KB
最終ジャッジ日時 2023-09-29 22:36:32
合計ジャッジ時間 2,153 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,840 KB
testcase_01 AC 15 ms
7,804 KB
testcase_02 AC 15 ms
7,948 KB
testcase_03 AC 15 ms
7,760 KB
testcase_04 AC 59 ms
14,936 KB
testcase_05 AC 15 ms
7,876 KB
testcase_06 AC 120 ms
23,900 KB
testcase_07 AC 50 ms
13,316 KB
testcase_08 AC 68 ms
16,404 KB
testcase_09 AC 123 ms
23,992 KB
testcase_10 AC 99 ms
20,944 KB
testcase_11 AC 90 ms
19,504 KB
testcase_12 AC 94 ms
20,128 KB
testcase_13 AC 88 ms
19,240 KB
testcase_14 AC 54 ms
14,260 KB
testcase_15 AC 15 ms
7,792 KB
testcase_16 AC 18 ms
8,816 KB
testcase_17 AC 18 ms
8,904 KB
testcase_18 AC 18 ms
8,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
w = int(input())
h = int(input())
n = int(input())
a = [[*map(int, input().split())] for _ in range(n)]

mark = [0 for i in range(w)]
num = [0 for i in range(h)]
for x in a:
    mark[x[0] - 1] = 1
    num[x[1] - 1] = 1
cnt1 = mark.count(1)
cnt2 = num.count(1)
ans = cnt1 * h + cnt2 * w - cnt1*cnt2 - n
print(ans)
0