結果
| 問題 |
No.444 旨味の相乗効果
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-04-19 20:10:06 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 608 bytes |
| コンパイル時間 | 488 ms |
| コンパイル使用メモリ | 82,236 KB |
| 実行使用メモリ | 72,280 KB |
| 最終ジャッジ日時 | 2025-01-02 12:24:43 |
| 合計ジャッジ時間 | 2,991 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 WA * 1 |
| other | AC * 22 WA * 1 |
ソースコード
n,c = map(int,input().split())
a = list(map(int,input().split()))
from collections import defaultdict
d = defaultdict(int)
for i in a:
d[i] += 1
P = 10 ** 9 + 7
def f(c,k):
if k > c:return 0
c -= 1
k -= 1
ans = 1
for i in range(k):
ans = ans * (c - i) * pow(k - i,P-2,P) % P
return ans
ans = 0
for i in d:
inv = pow(i,P-2,P)
u = 1
for j in d:
if j == i:continue
t = (1 - j * inv) % P
t = pow(t,P-2,P)
t = pow(t,d[j],P)
u = u * t % P
v = pow(i,c,P)
ans += (u * f(c,d[i]) - d[i]) * v
ans %= P
print(ans)