結果

問題 No.444 旨味の相乗効果
ユーザー ああいいああいい
提出日時 2022-04-19 20:10:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 608 bytes
コンパイル時間 1,503 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 78,192 KB
最終ジャッジ日時 2023-08-30 18:21:29
合計ジャッジ時間 5,427 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
71,520 KB
testcase_01 AC 86 ms
71,776 KB
testcase_02 AC 87 ms
71,516 KB
testcase_03 AC 86 ms
71,488 KB
testcase_04 WA -
testcase_05 AC 89 ms
71,752 KB
testcase_06 AC 88 ms
71,680 KB
testcase_07 AC 106 ms
77,868 KB
testcase_08 AC 90 ms
71,852 KB
testcase_09 AC 90 ms
71,836 KB
testcase_10 AC 88 ms
71,844 KB
testcase_11 AC 87 ms
71,308 KB
testcase_12 AC 109 ms
77,424 KB
testcase_13 AC 102 ms
77,364 KB
testcase_14 AC 90 ms
71,376 KB
testcase_15 AC 89 ms
71,716 KB
testcase_16 WA -
testcase_17 AC 88 ms
71,892 KB
testcase_18 AC 89 ms
71,692 KB
testcase_19 AC 107 ms
77,888 KB
testcase_20 AC 111 ms
77,972 KB
testcase_21 AC 87 ms
71,608 KB
testcase_22 AC 88 ms
71,684 KB
testcase_23 AC 90 ms
71,632 KB
testcase_24 AC 108 ms
77,808 KB
testcase_25 AC 89 ms
71,528 KB
testcase_26 AC 88 ms
71,532 KB
testcase_27 AC 89 ms
71,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0