結果

問題 No.1972 Modulo Set
ユーザー Issei MoriIssei Mori
提出日時 2022-06-10 23:53:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 552 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 81,612 KB
実行使用メモリ 135,288 KB
最終ジャッジ日時 2023-10-21 05:54:27
合計ジャッジ時間 5,626 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
55,520 KB
testcase_01 AC 43 ms
55,520 KB
testcase_02 AC 44 ms
55,520 KB
testcase_03 WA -
testcase_04 AC 70 ms
78,128 KB
testcase_05 WA -
testcase_06 AC 89 ms
91,552 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 60 ms
66,540 KB
testcase_10 WA -
testcase_11 AC 103 ms
99,592 KB
testcase_12 AC 64 ms
71,556 KB
testcase_13 AC 58 ms
68,832 KB
testcase_14 AC 62 ms
70,908 KB
testcase_15 AC 114 ms
103,072 KB
testcase_16 AC 121 ms
105,184 KB
testcase_17 WA -
testcase_18 AC 43 ms
55,520 KB
testcase_19 AC 112 ms
97,792 KB
testcase_20 WA -
testcase_21 AC 82 ms
84,956 KB
testcase_22 AC 106 ms
95,136 KB
testcase_23 AC 173 ms
116,116 KB
testcase_24 AC 96 ms
98,680 KB
testcase_25 AC 123 ms
104,760 KB
testcase_26 WA -
testcase_27 AC 172 ms
118,232 KB
testcase_28 AC 95 ms
100,716 KB
testcase_29 AC 117 ms
115,836 KB
testcase_30 AC 147 ms
111,368 KB
testcase_31 AC 57 ms
66,520 KB
testcase_32 AC 135 ms
128,912 KB
testcase_33 AC 197 ms
135,288 KB
testcase_34 AC 193 ms
135,196 KB
testcase_35 AC 197 ms
135,284 KB
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict


def get_list(ty=int):
    return list(map(ty, input().split()))


def get_int():
    return int(input())


def get_str():
    return input()


N, M = get_list()
A = get_list()

if M == 1:
    print(1)
    exit()

cnt = defaultdict(int)
for a in set(A):
    cnt[a % M] += 1

ans = 0
if cnt[0] > 0 or cnt[M//2] > 0:
    ans += 1

keys = cnt.keys()
used = {0, M//2}
for k in list(keys):
    if not k in used:
        used.add(k)
        k2 = M-k
        used.add(k2)
        ans += max(cnt[k], cnt[k2])

print(ans)


0