結果
| 問題 | 
                            No.1972 Modulo Set
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-06-23 13:13:01 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                MLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 303 bytes | 
| コンパイル時間 | 325 ms | 
| コンパイル使用メモリ | 82,280 KB | 
| 実行使用メモリ | 693,640 KB | 
| 最終ジャッジ日時 | 2024-11-07 03:34:46 | 
| 合計ジャッジ時間 | 7,307 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 25 MLE * 1 -- * 8 | 
ソースコード
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)