結果
| 問題 |
No.1972 Modulo Set
|
| コンテスト | |
| ユーザー |
SidewaysOwl
|
| 提出日時 | 2022-06-11 09:50:15 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 141 ms / 2,000 ms |
| コード長 | 437 bytes |
| コンパイル時間 | 251 ms |
| コンパイル使用メモリ | 82,360 KB |
| 実行使用メモリ | 116,200 KB |
| 最終ジャッジ日時 | 2024-10-05 01:43:22 |
| 合計ジャッジ時間 | 4,585 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
n,m = map(int,input().split())
a = list(map(int,input().split()))
from collections import defaultdict
m_d = defaultdict(int)
for i in range(n):
m_d[a[i]%m] += 1
ans = 0
if m_d[0]:ans += 1
if not (m&1) and m_d[m//2]:ans +=1
memo = set()
for key in list(m_d.keys())[::]:
if key == 0:continue
if not (m&1) and key == m//2:continue
if key in memo:continue
ans += max(m_d[key], m_d[m-key])
memo.add(m-key)
print(ans)
SidewaysOwl