結果

問題 No.1972 Modulo Set
ユーザー ThetaTheta
提出日時 2022-11-07 16:21:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 625 bytes
コンパイル時間 150 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 55,320 KB
最終ジャッジ日時 2023-09-28 05:28:03
合計ジャッジ時間 10,358 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,464 KB
testcase_01 AC 18 ms
8,596 KB
testcase_02 AC 18 ms
8,532 KB
testcase_03 AC 27 ms
10,960 KB
testcase_04 AC 32 ms
11,636 KB
testcase_05 AC 34 ms
12,572 KB
testcase_06 AC 46 ms
14,364 KB
testcase_07 AC 59 ms
17,656 KB
testcase_08 AC 37 ms
13,100 KB
testcase_09 AC 20 ms
9,296 KB
testcase_10 AC 33 ms
11,816 KB
testcase_11 AC 58 ms
17,064 KB
testcase_12 AC 22 ms
9,960 KB
testcase_13 AC 33 ms
11,380 KB
testcase_14 AC 31 ms
11,392 KB
testcase_15 AC 65 ms
16,752 KB
testcase_16 AC 72 ms
19,772 KB
testcase_17 AC 35 ms
12,496 KB
testcase_18 AC 19 ms
8,824 KB
testcase_19 AC 65 ms
18,676 KB
testcase_20 AC 76 ms
18,720 KB
testcase_21 AC 40 ms
13,024 KB
testcase_22 AC 64 ms
17,456 KB
testcase_23 AC 266 ms
55,180 KB
testcase_24 AC 223 ms
31,336 KB
testcase_25 AC 276 ms
53,344 KB
testcase_26 AC 76 ms
19,632 KB
testcase_27 AC 346 ms
55,320 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)

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

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

    print(sum(modulo_counter.values()))


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