結果
| 問題 |
No.1972 Modulo Set
|
| コンテスト | |
| ユーザー |
8nd5t
|
| 提出日時 | 2022-06-10 21:39:29 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 936 bytes |
| コンパイル時間 | 344 ms |
| コンパイル使用メモリ | 82,380 KB |
| 実行使用メモリ | 142,596 KB |
| 最終ジャッジ日時 | 2024-09-21 06:05:42 |
| 合計ジャッジ時間 | 8,673 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 WA * 8 |
ソースコード
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right
import sys,math,itertools,pprint,fractions
sys.setrecursionlimit(10**8)
mod = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_1(): return list(map(lambda x:int(x)-1, sys.stdin.readline().split()))
def inplm(): return map(int, sys.stdin.readline().split())
def inpl_1m(): return map(lambda x:int(x)-1, sys.stdin.readline().split())
def err(x): print(x); exit()
n,m = inpl()
a = inpl()
if n == 1:
err(1)
if m == 1:
err(0)
d = defaultdict(int)
for x in a:
d[x%m] += 1
res = n
seen = set()
for key in list(d):
if key in seen:
continue
if key == 0:
res -= d[key]-1
else:
seen.add(key)
seen.add(m-key)
res -= min(d[key], d[m-key])
print(res)
8nd5t