結果
| 問題 |
No.1972 Modulo Set
|
| コンテスト | |
| ユーザー |
lilictaka
|
| 提出日時 | 2022-06-12 01:51:36 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 420 bytes |
| コンパイル時間 | 486 ms |
| コンパイル使用メモリ | 82,540 KB |
| 実行使用メモリ | 125,960 KB |
| 最終ジャッジ日時 | 2024-09-22 12:06:49 |
| 合計ジャッジ時間 | 6,344 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 WA * 5 |
ソースコード
from collections import defaultdict
N,M = map(int,input().split())
A = list(map(int,input().split()))
seen = defaultdict(bool)
cnt = defaultdict(int)
ans = 0
for a in A:
cnt[a%M] += 1
keys = list(cnt.keys())
for key in keys:
if key == 0:
ans += 1
continue
if seen[key]:
continue
inv = M - key
ans += max(cnt[key],cnt[inv])
seen[key] = True
seen[inv] = True
print(ans)
lilictaka