結果
問題 |
No.2963 Mecha DESU
|
ユーザー |
![]() |
提出日時 | 2024-11-30 12:40:55 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 547 bytes |
コンパイル時間 | 252 ms |
コンパイル使用メモリ | 81,860 KB |
実行使用メモリ | 252,868 KB |
最終ジャッジ日時 | 2024-11-30 12:41:16 |
合計ジャッジ時間 | 18,207 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 56 TLE * 1 |
ソースコード
from collections import defaultdict MOD = 998244353 N, M, K = map(int, input().split()) A = list(map(int, input().split())) dic0 = defaultdict(int) for a in A: dic0[a] += 1 dic1 = defaultdict(int) for k,v in dic0.items(): for i in range(1, N // k + 1): dic1[i * k] += v dic2 = defaultdict(int) for v in dic1.values(): dic2[v] += 1 tmp = 0 for k, v in dic2.items(): tmp += v * pow(M - k, K, MOD) tmp %= MOD all = pow(M, K, MOD) ans = all * (N + 1) ans -= tmp ans %= MOD ans *= pow(all, -1, MOD) ans %= MOD print(ans)