結果
問題 | No.11 カードマッチ |
ユーザー | gorugo30 |
提出日時 | 2021-02-25 21:49:28 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 667 bytes |
コンパイル時間 | 279 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 77,608 KB |
最終ジャッジ日時 | 2024-04-08 22:05:21 |
合計ジャッジ時間 | 2,283 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 39 ms
53,460 KB |
testcase_01 | AC | 38 ms
53,460 KB |
testcase_02 | AC | 38 ms
53,460 KB |
testcase_03 | AC | 39 ms
53,460 KB |
testcase_04 | AC | 49 ms
66,344 KB |
testcase_05 | AC | 38 ms
53,460 KB |
testcase_06 | WA | - |
testcase_07 | AC | 48 ms
64,984 KB |
testcase_08 | WA | - |
testcase_09 | AC | 52 ms
75,340 KB |
testcase_10 | AC | 50 ms
72,308 KB |
testcase_11 | AC | 49 ms
71,016 KB |
testcase_12 | AC | 51 ms
71,576 KB |
testcase_13 | AC | 51 ms
70,640 KB |
testcase_14 | AC | 51 ms
65,648 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
ソースコード
W = int(input()) H = int(input()) N = int(input()) hand = [tuple(map(int, input().split())) for i in range(N)] hset = set(hand) cntmark = [H] * (W + 1) cntmark[0] = 0 cntnum = [W] * (H + 1) cntnum[0] = 0 for m, n in hand: cntmark[m] -= 1 cntnum[n] -= 1 ans = 0 donem = set() donen = set() for m, n in hand: if m not in donem: ans += cntmark[m] donem.add(m) if n not in donen: ans += cntnum[n] donen.add(n) for i in range(N): mi, ni = hand[i] for j in range(i + 1, N): mj, nj = hand[j] if (mi, nj) not in hset: ans -= 1 if (mj, ni) not in hset: ans -= 1 print(ans)