結果

問題 No.1972 Modulo Set
ユーザー chineristAC
提出日時 2022-06-10 21:41:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 562 bytes
コンパイル時間 366 ms
コンパイル使用メモリ 82,816 KB
実行使用メモリ 107,520 KB
最終ジャッジ日時 2024-09-21 06:06:52
合計ジャッジ時間 4,434 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random,bisect
from collections import deque,defaultdict,Counter
from heapq import heapify,heappop,heappush
from itertools import cycle, permutations
from math import log,gcd

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

N,M = mi()
A = li()

S = {a%M:0 for a in A}
for a in A:
    a %= M
    S[a] += 1
    
res = 0
for a in S:
    if M-a not in S:
        res += S[a]
    else:
        if a < M-a:
            res += max(S[a],S[M-a])
        elif a==M-a:
            res += 1

print(res)
0