結果

問題 No.1972 Modulo Set
ユーザー ThetaTheta
提出日時 2022-11-07 16:29:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 609 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 10,796 KB
実行使用メモリ 22,324 KB
最終ジャッジ日時 2023-09-28 05:36:04
合計ジャッジ時間 7,273 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
22,324 KB
testcase_01 AC 19 ms
8,476 KB
testcase_02 AC 19 ms
8,472 KB
testcase_03 AC 29 ms
10,464 KB
testcase_04 AC 35 ms
10,972 KB
testcase_05 AC 38 ms
11,228 KB
testcase_06 AC 49 ms
12,956 KB
testcase_07 AC 65 ms
15,336 KB
testcase_08 AC 40 ms
11,928 KB
testcase_09 AC 23 ms
8,980 KB
testcase_10 AC 35 ms
10,892 KB
testcase_11 AC 66 ms
15,148 KB
testcase_12 AC 26 ms
9,624 KB
testcase_13 AC 37 ms
9,284 KB
testcase_14 AC 34 ms
9,364 KB
testcase_15 AC 75 ms
16,908 KB
testcase_16 AC 84 ms
17,608 KB
testcase_17 AC 39 ms
11,820 KB
testcase_18 AC 21 ms
8,648 KB
testcase_19 AC 77 ms
15,932 KB
testcase_20 AC 90 ms
20,084 KB
testcase_21 AC 44 ms
12,444 KB
testcase_22 AC 73 ms
15,424 KB
testcase_23 AC 303 ms
21,140 KB
testcase_24 AC 251 ms
13,888 KB
testcase_25 AC 310 ms
18,312 KB
testcase_26 AC 89 ms
19,128 KB
testcase_27 AC 415 ms
21,252 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())
    modulo_list = map(lambda num: int(num) % M, input().split())

    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