結果

問題 No.1972 Modulo Set
ユーザー ThetaTheta
提出日時 2022-11-07 16:28:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 636 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 10,904 KB
実行使用メモリ 20,288 KB
最終ジャッジ日時 2023-09-28 05:35:17
合計ジャッジ時間 8,432 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,540 KB
testcase_01 AC 20 ms
8,608 KB
testcase_02 AC 18 ms
8,544 KB
testcase_03 AC 29 ms
10,804 KB
testcase_04 AC 34 ms
11,528 KB
testcase_05 AC 38 ms
12,444 KB
testcase_06 AC 48 ms
14,464 KB
testcase_07 AC 65 ms
17,700 KB
testcase_08 AC 40 ms
13,248 KB
testcase_09 AC 22 ms
9,012 KB
testcase_10 AC 34 ms
11,820 KB
testcase_11 AC 63 ms
17,068 KB
testcase_12 AC 25 ms
9,960 KB
testcase_13 AC 36 ms
9,352 KB
testcase_14 AC 33 ms
9,308 KB
testcase_15 AC 70 ms
16,632 KB
testcase_16 AC 77 ms
16,636 KB
testcase_17 AC 37 ms
12,616 KB
testcase_18 AC 20 ms
8,508 KB
testcase_19 AC 71 ms
16,180 KB
testcase_20 AC 85 ms
19,624 KB
testcase_21 AC 42 ms
13,108 KB
testcase_22 AC 68 ms
14,768 KB
testcase_23 AC 291 ms
20,236 KB
testcase_24 AC 241 ms
14,516 KB
testcase_25 AC 297 ms
17,820 KB
testcase_26 AC 88 ms
19,804 KB
testcase_27 AC 390 ms
20,288 KB
testcase_28 TLE -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter


def main():
    N, M = map(int, input().split())
    set_ = list(map(int, input().split()))
    modulo_list = map(lambda num: num % M, set_)

    modulo_counter = Counter(modulo_list)

    element_sum = 0

    if modulo_counter[0] > 0:
        element_sum += 1
    if M % 2 == 0 and modulo_counter[M // 2] > 0:
        element_sum += 1

    for num in range(1, (M+1)//2):
        if modulo_counter[num] > modulo_counter[M-num]:
            element_sum += modulo_counter[num]
        else:
            element_sum += modulo_counter[M-num]

    print(element_sum)


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