結果

問題 No.1390 Get together
ユーザー HAPPAHAPPA
提出日時 2021-02-12 21:52:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 638 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 10,908 KB
実行使用メモリ 66,572 KB
最終ジャッジ日時 2023-09-27 03:46:30
合計ジャッジ時間 13,645 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,552 KB
testcase_01 AC 19 ms
8,604 KB
testcase_02 AC 19 ms
8,516 KB
testcase_03 AC 29 ms
9,640 KB
testcase_04 AC 28 ms
9,460 KB
testcase_05 WA -
testcase_06 AC 28 ms
9,644 KB
testcase_07 WA -
testcase_08 AC 29 ms
9,608 KB
testcase_09 AC 32 ms
9,756 KB
testcase_10 AC 19 ms
8,616 KB
testcase_11 AC 19 ms
8,672 KB
testcase_12 AC 19 ms
8,492 KB
testcase_13 WA -
testcase_14 AC 19 ms
8,652 KB
testcase_15 AC 18 ms
8,488 KB
testcase_16 WA -
testcase_17 AC 530 ms
37,948 KB
testcase_18 AC 676 ms
66,572 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 711 ms
54,888 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 712 ms
55,096 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, m = map(int, input().split())
    cnt_col = [0] * n
    box = [defaultdict(int) for _ in range(m)]
    for _ in range(n):
        b, c = map(lambda x: int(x) - 1, input().split())
        cnt_col[c] += 1
        box[b][c] += 1

    cnt_max = [0] * n
    for i in range(m):
        for k, v in box[i].items():
            cnt_max[k] = max(cnt_max[k], v)

    res = sum(cnt_col[i] - cnt_max[i] for i in range(n))
    print(res)


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