結果
| 問題 |
No.1972 Modulo Set
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-06-12 07:07:34 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 105 ms / 2,000 ms |
| コード長 | 390 bytes |
| コンパイル時間 | 174 ms |
| コンパイル使用メモリ | 82,320 KB |
| 実行使用メモリ | 107,988 KB |
| 最終ジャッジ日時 | 2024-10-05 01:46:04 |
| 合計ジャッジ時間 | 3,979 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
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
continue
elif M % 2 == 0 and a == M // 2:
ans -= v - 1
elif M - a in d:
u = min(v,d[M - a])
tmp += u
print(ans - tmp // 2)