結果

問題 No.11 カードマッチ
ユーザー cherrypi59cherrypi59
提出日時 2018-09-30 17:41:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 118 ms / 5,000 ms
コード長 387 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 26,368 KB
最終ジャッジ日時 2024-04-20 13:43:33
合計ジャッジ時間 1,799 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,752 KB
testcase_01 AC 28 ms
10,752 KB
testcase_02 AC 28 ms
10,880 KB
testcase_03 AC 28 ms
10,752 KB
testcase_04 AC 92 ms
17,244 KB
testcase_05 AC 27 ms
10,752 KB
testcase_06 AC 118 ms
26,112 KB
testcase_07 AC 37 ms
15,744 KB
testcase_08 AC 69 ms
18,560 KB
testcase_09 AC 116 ms
26,368 KB
testcase_10 AC 101 ms
23,128 KB
testcase_11 AC 89 ms
22,016 KB
testcase_12 AC 89 ms
22,436 KB
testcase_13 AC 75 ms
21,504 KB
testcase_14 AC 74 ms
16,512 KB
testcase_15 AC 27 ms
10,752 KB
testcase_16 AC 27 ms
11,136 KB
testcase_17 AC 27 ms
11,392 KB
testcase_18 AC 26 ms
11,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    w, h, n = [int(input()) for i in range(3)]

    soot, no = [0] * w, [0] * h
    for i in range(n):
        s, k = map(int, input().split())
        soot[s-1] = no[k-1] = 1

    ans, used_no = 0, sum(no)
    
    for i in range(w):
        if soot[i]:
            ans += h
        else:
            ans += used_no

    print(ans-n)


if __name__ == '__main__':
    main()
0