結果
問題 |
No.1972 Modulo Set
|
ユーザー |
![]() |
提出日時 | 2022-06-11 09:48:24 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 561 bytes |
コンパイル時間 | 149 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 116,480 KB |
最終ジャッジ日時 | 2024-09-21 18:21:04 |
合計ジャッジ時間 | 4,942 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 WA * 8 |
ソースコード
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 max_ = 0 for key in m_d.keys(): if key == 0:continue if not (m&1) and key == m//2:continue max_ += m_d[key] 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)