結果
| 問題 |
No.1972 Modulo Set
|
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2022-12-30 03:35:32 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 390 bytes |
| コンパイル時間 | 155 ms |
| コンパイル使用メモリ | 82,184 KB |
| 実行使用メモリ | 110,000 KB |
| 最終ジャッジ日時 | 2024-11-25 01:43:13 |
| 合計ジャッジ時間 | 4,322 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 WA * 8 |
ソースコード
from collections import *
N, M = map(int, input().split())
A = list(map(int, input().split()))
D = defaultdict(int)
for a in A:
D[a % M] += 1
D[M - a % M] += 0
ans = 0
for k, v in D.items():
if k % M == 0 :
ans += min(1, D[k%M])
else:
ans += max(D[k], D[M - k])
if M % 2 == 0:
ans -= D[M//2] * 2
ans += min(1, D[M//2]) * 2
print(ans // 2)
rlangevin