結果

問題 No.11 カードマッチ
ユーザー human_cipherhuman_cipher
提出日時 2021-06-20 22:41:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 591 bytes
コンパイル時間 535 ms
コンパイル使用メモリ 10,940 KB
実行使用メモリ 24,096 KB
最終ジャッジ日時 2023-09-05 01:42:53
合計ジャッジ時間 3,809 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,832 KB
testcase_01 AC 16 ms
7,832 KB
testcase_02 AC 15 ms
7,800 KB
testcase_03 AC 16 ms
7,876 KB
testcase_04 AC 136 ms
14,864 KB
testcase_05 AC 16 ms
7,832 KB
testcase_06 WA -
testcase_07 AC 111 ms
13,564 KB
testcase_08 WA -
testcase_09 AC 287 ms
24,096 KB
testcase_10 AC 239 ms
20,676 KB
testcase_11 AC 217 ms
19,404 KB
testcase_12 AC 225 ms
20,124 KB
testcase_13 AC 207 ms
19,112 KB
testcase_14 AC 126 ms
14,148 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

w = int(input())
h = int(input())
n = int(input())
SK = set([tuple(map(int,input().split())) for _ in range(n)])

Mark = [0 for _ in range(w+1)]
Num = [0 for _ in range(h+1)]

for s,k in SK:
    Mark[s] += 1
    Num[k] += 1

ans = 0
for i in range(w+1):
    if Mark[i] > 0:
        ans += (h-Mark[i])
for i in range(h+1):
    if Num[i] > 0:
        ans += (w-Num[i])

col = 0
for s0,k0 in SK:
    for s1,k1 in SK:
        if s0 != s1 and k0 != k1:
            if (s0,k1) not in SK:
                col += 1
            if (s1,k0) not in SK:
                col += 1
ans -= col//2
print(ans)
0