結果
| 問題 |
No.1972 Modulo Set
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-06-12 07:02:57 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 377 bytes |
| コンパイル時間 | 294 ms |
| コンパイル使用メモリ | 82,492 KB |
| 実行使用メモリ | 107,804 KB |
| 最終ジャッジ日時 | 2024-09-22 16:59:38 |
| 合計ジャッジ時間 | 4,435 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 WA * 8 |
ソースコード
N,M = map(int,input().split())
A = list(map(int,input().split()))
from collections import defaultdict
d = defaultdict(int)
for a in A:
d[a % M] += 1
ans = N
tmp = 0
for a,v in d.items():
if a == 0:
ans -= v - 1
elif M - a in d:
u = min(v,d[M - a])
tmp += u
if M % 2 == 0 and M // 2 in d:
v = d[M // 2]
ans += 1
print(ans - tmp // 2)