結果

問題 No.1972 Modulo Set
ユーザー 👑 KazunKazun
提出日時 2021-08-20 23:27:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 326 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 82,312 KB
実行使用メモリ 107,884 KB
最終ジャッジ日時 2024-04-15 08:42:35
合計ジャッジ時間 4,590 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
53,888 KB
testcase_01 AC 43 ms
53,504 KB
testcase_02 AC 41 ms
53,504 KB
testcase_03 AC 61 ms
69,504 KB
testcase_04 AC 62 ms
71,936 KB
testcase_05 AC 66 ms
74,496 KB
testcase_06 AC 71 ms
79,744 KB
testcase_07 AC 85 ms
90,112 KB
testcase_08 AC 61 ms
73,472 KB
testcase_09 AC 57 ms
65,280 KB
testcase_10 AC 63 ms
72,832 KB
testcase_11 AC 79 ms
87,032 KB
testcase_12 AC 59 ms
68,736 KB
testcase_13 AC 57 ms
65,536 KB
testcase_14 AC 57 ms
66,944 KB
testcase_15 AC 92 ms
92,032 KB
testcase_16 AC 100 ms
94,328 KB
testcase_17 AC 67 ms
74,496 KB
testcase_18 AC 42 ms
53,504 KB
testcase_19 AC 90 ms
89,728 KB
testcase_20 AC 102 ms
96,000 KB
testcase_21 AC 70 ms
76,800 KB
testcase_22 AC 85 ms
87,552 KB
testcase_23 AC 125 ms
104,688 KB
testcase_24 AC 80 ms
83,584 KB
testcase_25 AC 91 ms
93,440 KB
testcase_26 AC 104 ms
97,152 KB
testcase_27 AC 126 ms
104,704 KB
testcase_28 AC 75 ms
83,328 KB
testcase_29 AC 88 ms
92,032 KB
testcase_30 AC 105 ms
103,936 KB
testcase_31 AC 56 ms
64,640 KB
testcase_32 AC 104 ms
99,712 KB
testcase_33 AC 138 ms
107,776 KB
testcase_34 AC 139 ms
107,804 KB
testcase_35 AC 137 ms
107,884 KB
testcase_36 AC 138 ms
107,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

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

A=list(map(int,input().split()))
D=defaultdict(int)

for a in A:
    D[a%M]+=1

X=0
K=list(D.keys())
for a in K:
    b=(M-a)%M
    if a==b:
        if D[a]:
            X+=1
            D[a]=0
    else:
        X+=max(D[a],D[b])
        D[a]=D[b]=0

print(X)
0