結果

問題 No.1972 Modulo Set
ユーザー 河野竜也
提出日時 2022-06-23 13:12:40
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 303 bytes
コンパイル時間 234 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 352,884 KB
最終ジャッジ日時 2024-11-07 03:34:21
合計ジャッジ時間 11,654 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 TLE * 1 -- * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

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