結果

問題 No.1972 Modulo Set
ユーザー 👑 H20H20
提出日時 2022-06-10 21:40:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 310 bytes
コンパイル時間 369 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 107,904 KB
最終ジャッジ日時 2024-04-15 08:48:43
合計ジャッジ時間 5,297 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
54,016 KB
testcase_01 AC 47 ms
53,504 KB
testcase_02 AC 45 ms
54,144 KB
testcase_03 AC 73 ms
69,760 KB
testcase_04 AC 72 ms
72,832 KB
testcase_05 AC 71 ms
74,496 KB
testcase_06 AC 80 ms
81,716 KB
testcase_07 AC 108 ms
89,984 KB
testcase_08 AC 79 ms
73,600 KB
testcase_09 AC 72 ms
65,028 KB
testcase_10 AC 71 ms
73,088 KB
testcase_11 AC 88 ms
88,452 KB
testcase_12 AC 64 ms
67,840 KB
testcase_13 AC 62 ms
66,432 KB
testcase_14 AC 64 ms
67,456 KB
testcase_15 AC 104 ms
92,544 KB
testcase_16 AC 134 ms
96,696 KB
testcase_17 AC 79 ms
74,112 KB
testcase_18 AC 47 ms
54,016 KB
testcase_19 AC 115 ms
89,856 KB
testcase_20 AC 118 ms
99,084 KB
testcase_21 AC 72 ms
76,672 KB
testcase_22 AC 89 ms
87,168 KB
testcase_23 AC 132 ms
107,904 KB
testcase_24 AC 82 ms
83,840 KB
testcase_25 AC 110 ms
94,208 KB
testcase_26 AC 114 ms
96,348 KB
testcase_27 AC 143 ms
107,652 KB
testcase_28 AC 81 ms
84,992 KB
testcase_29 AC 96 ms
93,184 KB
testcase_30 AC 116 ms
105,088 KB
testcase_31 AC 58 ms
65,408 KB
testcase_32 AC 107 ms
100,616 KB
testcase_33 AC 143 ms
101,072 KB
testcase_34 AC 140 ms
101,336 KB
testcase_35 AC 149 ms
101,452 KB
testcase_36 AC 138 ms
101,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
N,M = map(int, input().split())
A = list(map(int, input().split()))
CA = collections.Counter()
for a in A:
    CA[a%M]+=1
    CA[M-a%M]+=0
ans = 0
for k,v in CA.items():
    if k*2==M or k==0:
        ans+=2
    elif k==M:
        pass
    else:
        ans+=max(CA[k],CA[M-k])
print(ans//2)
0