結果

問題 No.11 カードマッチ
ユーザー nbisconbisco
提出日時 2016-04-13 21:30:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 538 bytes
コンパイル時間 392 ms
コンパイル使用メモリ 10,948 KB
実行使用メモリ 7,976 KB
最終ジャッジ日時 2023-08-02 00:28:08
合計ジャッジ時間 1,555 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,812 KB
testcase_01 AC 15 ms
7,824 KB
testcase_02 AC 14 ms
7,892 KB
testcase_03 AC 15 ms
7,776 KB
testcase_04 AC 14 ms
7,952 KB
testcase_05 AC 15 ms
7,760 KB
testcase_06 AC 14 ms
7,816 KB
testcase_07 AC 16 ms
7,780 KB
testcase_08 AC 15 ms
7,784 KB
testcase_09 AC 15 ms
7,840 KB
testcase_10 AC 15 ms
7,788 KB
testcase_11 AC 15 ms
7,764 KB
testcase_12 AC 16 ms
7,816 KB
testcase_13 AC 15 ms
7,976 KB
testcase_14 AC 16 ms
7,816 KB
testcase_15 AC 16 ms
7,808 KB
testcase_16 AC 15 ms
7,840 KB
testcase_17 AC 15 ms
7,820 KB
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
#fileencoding: utf-8

W = int(input())
H = int(input())
N = int(input())

total = 0
marks = set([])
nums = set([])
for _ in range(N):
    s, k = [int(i) for i in input().strip().split(" ")]
    if s not in marks:
        total += (H - 1 - len(nums))
        if k in nums:
            total += 1
        marks.add(s)
    else:
        total -= 1

    if k not in nums:
        total += (W - 1 - len(marks))
        if s in marks:
            total += 1
        nums.add(k)
    else:
        total -= 1

print(total)
0