結果

問題 No.1972 Modulo Set
ユーザー 河野竜也河野竜也
提出日時 2022-06-20 13:10:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
MLE  
実行時間 -
コード長 322 bytes
コンパイル時間 177 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 646,632 KB
最終ジャッジ日時 2024-04-21 02:24:44
合計ジャッジ時間 7,847 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
17,696 KB
testcase_01 AC 27 ms
10,752 KB
testcase_02 AC 27 ms
10,624 KB
testcase_03 AC 43 ms
12,868 KB
testcase_04 AC 50 ms
13,900 KB
testcase_05 AC 56 ms
14,532 KB
testcase_06 AC 71 ms
16,640 KB
testcase_07 AC 95 ms
19,740 KB
testcase_08 AC 57 ms
15,472 KB
testcase_09 AC 33 ms
11,520 KB
testcase_10 AC 49 ms
13,924 KB
testcase_11 AC 90 ms
19,364 KB
testcase_12 AC 38 ms
12,288 KB
testcase_13 AC 55 ms
16,132 KB
testcase_14 AC 48 ms
13,572 KB
testcase_15 AC 98 ms
18,716 KB
testcase_16 AC 136 ms
20,620 KB
testcase_17 AC 58 ms
14,716 KB
testcase_18 AC 31 ms
11,264 KB
testcase_19 AC 106 ms
20,516 KB
testcase_20 AC 121 ms
20,664 KB
testcase_21 AC 60 ms
15,332 KB
testcase_22 AC 106 ms
19,964 KB
testcase_23 AC 422 ms
57,416 KB
testcase_24 AC 372 ms
54,244 KB
testcase_25 AC 469 ms
97,260 KB
testcase_26 AC 128 ms
21,596 KB
testcase_27 AC 594 ms
98,876 KB
testcase_28 MLE -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
n,m=map(int,input().split())
a=list(map(int,input().split()))
ans=0
d=defaultdict(int)
for i in range(n):
  b=a[i]%m
  d[b]+=1
if d[0]:
  ans+=1
for i in range(1,(m//2)+1):
  if d[i]>=d[m-i]:
    ans+=d[i]
  else:
    ans+=d[m-i]
if m%2==0:
  if d[m//2]:
    ans-=(d[m//2]-1)
print(ans)
0