結果

問題 No.1972 Modulo Set
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2022-06-12 12:15:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 181 ms / 2,000 ms
コード長 399 bytes
コンパイル時間 198 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 127,104 KB
最終ジャッジ日時 2024-04-15 08:59:23
合計ジャッジ時間 5,401 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
51,712 KB
testcase_01 AC 43 ms
51,840 KB
testcase_02 AC 44 ms
51,840 KB
testcase_03 AC 75 ms
71,296 KB
testcase_04 AC 73 ms
71,808 KB
testcase_05 AC 79 ms
73,856 KB
testcase_06 AC 86 ms
80,896 KB
testcase_07 AC 97 ms
90,112 KB
testcase_08 AC 68 ms
72,448 KB
testcase_09 AC 65 ms
65,664 KB
testcase_10 AC 74 ms
72,832 KB
testcase_11 AC 98 ms
88,704 KB
testcase_12 AC 67 ms
68,992 KB
testcase_13 AC 66 ms
66,560 KB
testcase_14 AC 67 ms
67,584 KB
testcase_15 AC 114 ms
96,000 KB
testcase_16 AC 119 ms
101,760 KB
testcase_17 AC 81 ms
77,640 KB
testcase_18 AC 44 ms
52,096 KB
testcase_19 AC 114 ms
97,868 KB
testcase_20 AC 121 ms
105,468 KB
testcase_21 AC 84 ms
80,208 KB
testcase_22 AC 108 ms
96,768 KB
testcase_23 AC 155 ms
125,696 KB
testcase_24 AC 98 ms
93,800 KB
testcase_25 AC 122 ms
109,312 KB
testcase_26 AC 116 ms
97,408 KB
testcase_27 AC 158 ms
127,104 KB
testcase_28 AC 94 ms
94,244 KB
testcase_29 AC 117 ms
108,160 KB
testcase_30 AC 139 ms
124,928 KB
testcase_31 AC 65 ms
66,512 KB
testcase_32 AC 134 ms
119,296 KB
testcase_33 AC 175 ms
123,468 KB
testcase_34 AC 177 ms
123,384 KB
testcase_35 AC 177 ms
123,436 KB
testcase_36 AC 181 ms
123,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from _collections import defaultdict
n,m=map(int,input().split())
s=set()
a=list(map(int,input().split()))
for i in range(n):a[i]%=m
cnt=defaultdict(int)

ans=0
nod=set()

for x in a:
    cnt[x]+=1
for x in cnt:
    nod.add(x)
    nod.add((m-x)%m)

for x in nod:
    y=(m-x)%m
    if y<x:continue
    if x==y:
        ans+=min(1,cnt[x])
        continue
    ans+=max(cnt[x],cnt[y])
print(ans)





0