結果

問題 No.11 カードマッチ
ユーザー steek79steek79
提出日時 2015-11-12 22:24:25
言語 Python2
(2.7.18)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 447 bytes
コンパイル時間 125 ms
コンパイル使用メモリ 6,688 KB
実行使用メモリ 6,192 KB
最終ジャッジ日時 2023-10-11 15:45:02
合計ジャッジ時間 1,565 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
5,952 KB
testcase_01 AC 11 ms
6,032 KB
testcase_02 AC 12 ms
5,952 KB
testcase_03 AC 11 ms
6,076 KB
testcase_04 AC 12 ms
6,064 KB
testcase_05 AC 11 ms
6,044 KB
testcase_06 AC 12 ms
6,012 KB
testcase_07 AC 12 ms
6,024 KB
testcase_08 AC 12 ms
5,980 KB
testcase_09 AC 12 ms
6,180 KB
testcase_10 AC 12 ms
6,024 KB
testcase_11 AC 11 ms
6,112 KB
testcase_12 AC 12 ms
5,964 KB
testcase_13 AC 12 ms
5,960 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 12 ms
6,052 KB
testcase_17 AC 11 ms
5,968 KB
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

W = input()
H = input()
N = input()
hand = [tuple(map(int, raw_input().split())) for loop in xrange(N)]

cnt = 0
suit_hand = set([])
number_hand = set([])
for card in hand:
    if card[0] in suit_hand:
        cnt += W - len(suit_hand) - 1
    elif card[1] in suit_hand:
        cnt += H - len(number_hand) - 1
    else:
        cnt += W - len(number_hand) + H - len(suit_hand) - 2
    suit_hand.add(card[0])
    number_hand.add(card[1])
print cnt
0