結果
| 問題 | No.1972 Modulo Set |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-06-12 07:02:57 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 377 bytes |
| 記録 | |
| コンパイル時間 | 171 ms |
| コンパイル使用メモリ | 85,136 KB |
| 実行使用メモリ | 109,576 KB |
| 最終ジャッジ日時 | 2026-04-10 23:46:17 |
| 合計ジャッジ時間 | 5,489 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)