結果

問題 No.11 カードマッチ
コンテスト
ユーザー steek79
提出日時 2015-11-12 22:24:25
言語 PyPy2
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 447 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 153 ms
コンパイル使用メモリ 77,460 KB
最終ジャッジ日時 2025-12-03 17:48:40
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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