結果

問題 No.1972 Modulo Set
ユーザー ああいいああいい
提出日時 2022-06-12 07:07:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 82,944 KB
実行使用メモリ 107,808 KB
最終ジャッジ日時 2024-04-15 08:59:41
合計ジャッジ時間 4,887 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
53,376 KB
testcase_01 AC 49 ms
53,248 KB
testcase_02 AC 48 ms
53,376 KB
testcase_03 AC 78 ms
69,632 KB
testcase_04 AC 79 ms
72,576 KB
testcase_05 AC 79 ms
73,856 KB
testcase_06 AC 88 ms
80,640 KB
testcase_07 AC 107 ms
89,984 KB
testcase_08 AC 69 ms
73,500 KB
testcase_09 AC 63 ms
64,000 KB
testcase_10 AC 75 ms
72,192 KB
testcase_11 AC 102 ms
88,704 KB
testcase_12 AC 71 ms
68,608 KB
testcase_13 AC 64 ms
64,128 KB
testcase_14 AC 66 ms
65,920 KB
testcase_15 AC 113 ms
92,032 KB
testcase_16 AC 111 ms
94,208 KB
testcase_17 AC 76 ms
73,792 KB
testcase_18 AC 47 ms
53,504 KB
testcase_19 AC 95 ms
85,504 KB
testcase_20 AC 119 ms
95,872 KB
testcase_21 AC 87 ms
78,388 KB
testcase_22 AC 91 ms
83,072 KB
testcase_23 AC 122 ms
102,400 KB
testcase_24 AC 83 ms
78,184 KB
testcase_25 AC 94 ms
86,144 KB
testcase_26 AC 123 ms
97,024 KB
testcase_27 AC 120 ms
104,576 KB
testcase_28 AC 76 ms
76,288 KB
testcase_29 AC 86 ms
83,584 KB
testcase_30 AC 98 ms
92,032 KB
testcase_31 AC 59 ms
63,360 KB
testcase_32 AC 96 ms
88,832 KB
testcase_33 AC 131 ms
107,648 KB
testcase_34 AC 132 ms
107,688 KB
testcase_35 AC 135 ms
107,772 KB
testcase_36 AC 133 ms
107,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
A = list(map(int,input().split()))

from collections import defaultdict
d = defaultdict(int)
for a in A:
    d[a % M] += 1
ans = N
tmp = 0
for a,v in d.items():
    if a == 0:
        ans -= v - 1
        continue
    elif M % 2 == 0 and a == M // 2:
        ans -= v - 1
    elif M - a in d:
        u = min(v,d[M - a])
        tmp += u
print(ans - tmp // 2)
0